Challenge - 5 Problems
MySQL CLI and Workbench Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output of a SELECT query with WHERE clause in MySQL CLI
Consider a table employees with columns
id, name, and department. What is the output of the following query executed in MySQL CLI?SELECT name FROM employees WHERE department = 'Sales';
MySQL
SELECT name FROM employees WHERE department = 'Sales';
Attempts:
2 left
💡 Hint
Focus on the SELECT columns and the WHERE condition filtering by department.
✗ Incorrect
The query selects only the 'name' column for employees whose department is 'Sales'. Only Alice and Bob belong to Sales, so their names are returned.
📝 Syntax
intermediate2:00remaining
Identify the syntax error in a MySQL Workbench query
Which option contains a syntax error when run in MySQL Workbench?
SELECT * FROM orders WHERE order_date = '2023-01-01'
MySQL
SELECT * FROM orders WHERE order_date = '2023-01-01'
Attempts:
2 left
💡 Hint
Check the FROM clause syntax carefully.
✗ Incorrect
Option A is missing the keyword FROM before the table name, causing a syntax error.
❓ optimization
advanced2:00remaining
Optimizing a slow query in MySQL CLI
You have a large table
Which option will most improve query speed when run in MySQL CLI?
sales with millions of rows. The query below is slow:SELECT * FROM sales WHERE customer_id = 12345;
Which option will most improve query speed when run in MySQL CLI?
MySQL
SELECT * FROM sales WHERE customer_id = 12345;
Attempts:
2 left
💡 Hint
Indexes help MySQL find rows faster when filtering.
✗ Incorrect
Adding an index on customer_id allows MySQL to quickly locate matching rows instead of scanning the entire table.
🔧 Debug
advanced2:00remaining
Debugging connection error in MySQL Workbench
You try to connect to a MySQL server in Workbench but get the error:
"Can't connect to MySQL server on 'localhost' (10061)"
Which option is the most likely cause?
"Can't connect to MySQL server on 'localhost' (10061)"
Which option is the most likely cause?
Attempts:
2 left
💡 Hint
Connection errors usually relate to server availability or network.
✗ Incorrect
Error 10061 means the client cannot reach the server, often because the server is not running or listening on the expected port.
🧠 Conceptual
expert2:00remaining
Understanding transaction behavior in MySQL CLI
In MySQL CLI, you start a transaction with
But you forget to run
START TRANSACTION; and run:UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
But you forget to run
COMMIT; and close the CLI. What happens to the changes?Attempts:
2 left
💡 Hint
Think about what happens to uncommitted transactions when the session ends.
✗ Incorrect
Without COMMIT, MySQL rolls back the transaction when the connection closes, so no changes are saved.