Challenge - 5 Problems
Master of SELECT all columns
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this query?
Given a table Employees with columns id, name, and department, what will this query return?
SELECT * FROM Employees WHERE department = 'Sales';SQL
SELECT * FROM Employees WHERE department = 'Sales';
Attempts:
2 left
💡 Hint
The asterisk (*) means select all columns, but the WHERE clause filters rows.
✗ Incorrect
The query selects all columns (*) but only rows where the department is 'Sales'. So the output includes all columns for those employees.
❓ query_result
intermediate2:00remaining
What does this query return?
Consider a table Products with columns product_id, name, and price. What will this query output?
SELECT * FROM Products WHERE price > 100;SQL
SELECT * FROM Products WHERE price > 100;
Attempts:
2 left
💡 Hint
The * selects all columns, and WHERE filters rows by price.
✗ Incorrect
The query returns all columns for products where the price is greater than 100.
📝 Syntax
advanced2:00remaining
Which query is syntactically correct to select all columns from the table Orders?
Choose the correct SQL query that selects all columns from the Orders table.
Attempts:
2 left
💡 Hint
The standard way to select all columns uses * after SELECT.
✗ Incorrect
Only option D uses the correct syntax: SELECT * FROM Orders; Options B and C use invalid keywords, and D has an incomplete WHERE clause.
❓ optimization
advanced2:00remaining
Which query is more efficient to select all columns from Customers with country 'USA'?
You want to get all columns for customers from the USA. Which query is better for performance?
Attempts:
2 left
💡 Hint
Selecting only needed columns can improve performance.
✗ Incorrect
Option B explicitly selects needed columns and filters by country, which can be more efficient than selecting all columns with *. Option B selects all columns which may be unnecessary. Option B returns all customers. Option B returns only country column.
🧠 Conceptual
expert3:00remaining
What happens if you use SELECT * in a join query with tables Authors and Books?
Given two tables, Authors (id, name) and Books (id, title, author_id), what will this query return?
SELECT * FROM Authors JOIN Books ON Authors.id = Books.author_id;SQL
SELECT * FROM Authors JOIN Books ON Authors.id = Books.author_id;
Attempts:
2 left
💡 Hint
SELECT * returns all columns from all tables in the FROM and JOIN clauses.
✗ Incorrect
The query returns all columns from both Authors and Books for rows where Authors.id matches Books.author_id. There is no syntax error; columns with same names are returned with table prefixes.