0
0
SQLquery~20 mins

Tables, rows, and columns concept in SQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tables Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Identify the number of rows returned
Given the table Employees with columns id, name, and department, what is the number of rows returned by this query?
SELECT * FROM Employees WHERE department = 'Sales';
SQL
SELECT * FROM Employees WHERE department = 'Sales';
A0
B5
C3
D7
Attempts:
2 left
💡 Hint
Think about how many employees belong to the Sales department.
🧠 Conceptual
intermediate
1:30remaining
Understanding columns in a table
Which of the following best describes a column in a database table?
AA single record containing all data about one entity
BA temporary storage area for query results
CA horizontal set of data values representing multiple entities
DA vertical set of data values representing a specific attribute
Attempts:
2 left
💡 Hint
Think about how data is organized vertically in tables.
📝 Syntax
advanced
2:00remaining
Identify the correct SQL syntax to select specific columns
Which SQL query correctly selects only the name and department columns from the Employees table?
ASELECT name, department FROM Employees;
BSELECT * FROM Employees WHERE name, department;
CSELECT name & department FROM Employees;
DSELECT name department FROM Employees;
Attempts:
2 left
💡 Hint
Remember the syntax for selecting multiple columns uses commas.
🔧 Debug
advanced
2:00remaining
Find the error in this SQL query
What error will this SQL query produce?
SELECT id, name, department FROM Employees WHERE department = Sales;
ASyntax error due to missing quotes around 'Sales'
BNo error, query runs successfully
CRuntime error due to missing table Employees
DSyntax error due to missing comma between columns
Attempts:
2 left
💡 Hint
String values in SQL must be enclosed in quotes.
optimization
expert
2:30remaining
Optimize query to count rows efficiently
Which query is the most efficient way to count the number of employees in the Employees table?
ASELECT COUNT(id, name) FROM Employees;
BSELECT COUNT(*) FROM Employees;
CSELECT * FROM Employees; -- then count rows in application
DSELECT COUNT(department) FROM Employees WHERE department IS NOT NULL;
Attempts:
2 left
💡 Hint
Use SQL aggregate functions designed for counting rows.