Worksheets01. SQL Quiz
Total questions: 12
Worksheet time: 6mins
Which SQL keyword is used to retrieve data from a database?
SELECT
UPDATE
INSERT
DELETE
What will this query return?
All employees
Only employees younger than 30
Employees older than 30
Error
What is the function of the PRIMARY KEY in a table?
Allows duplicate values in a column
Ensures unique values and identifies each row
Automatically sorts the table
Acts as a foreign key
Given a table products(id, name, price), what does this query do?
Selects all products cheaper than 3
Selects the 3 most expensive products
Selects the 3 cheapest products
Error
Which SQL statement is used to add new rows into a table?
ADD
APPEND
INSERT INTO
CREATE
What is the result of this query?
Counts all rows in orders
Counts only orders with status "shipped"
Returns the total number of columns
Error
What does a FOREIGN KEY do?
Ensures unique values within a table
Links two tables together using a common column
Stores secret data
Automatically indexes the table
What will this query return?
Total salary for each department
Average salary for each department
Minimum salary for each department
Error
What is the purpose of a JOIN in SQL?
To combine rows from two or more tables based on a related column
To remove duplicate rows from a table
To insert data into multiple tables at once
To create a backup of the database
What is the difference between INNER JOIN and LEFT JOIN
INNER JOIN returns all rows from both tables
LEFT JOIN returns all rows from the left table, even if no match exists in the right table
INNER JOIN includes unmatched rows as NULL
No difference
What will this query return?
Only customers who made orders
All customers, with their orders if available
Only orders without customers
What does this query return?
All customers
Customers who have made more than 5 orders
Customers who have not placed any orders
Error
