What is the purpose of the SELECT statement in SQL?
The SELECT statement is used to retrieve data from a database table. It lets you choose which columns and rows to see.
Click to reveal answer
beginner
What does this query do? SELECT * FROM users;
This query retrieves all columns and all rows from the table named users. The asterisk (*) means 'all columns'.
Click to reveal answer
beginner
Why do we end SQL statements with a semicolon (;)?
The semicolon marks the end of an SQL statement. It tells the database that the command is complete and ready to run.
Click to reveal answer
beginner
What is a database table?
A database table is like a spreadsheet with rows and columns. It stores data in an organized way so you can find and use it easily.
Click to reveal answer
beginner
What happens when you run your first SQL query?
When you run your first SQL query, the database reads your command, finds the data you asked for, and shows it to you.
Click to reveal answer
What does the SELECT statement do?
ARetrieves data from a database
BDeletes data from a database
CUpdates data in a database
DCreates a new database
✗ Incorrect
The SELECT statement is used to get data from a database table.
What does the asterisk (*) mean in SELECT * FROM table_name;?
ASelect only one column
BSelect no columns
CSelect all columns
DSelect only rows with *
✗ Incorrect
The asterisk (*) means to select all columns from the table.
Why do SQL statements end with a semicolon (;)?
ATo mark the end of the statement
BTo start the statement
CTo comment the statement
DTo ignore the statement
✗ Incorrect
The semicolon tells the database that the SQL command is complete.
What is a database table similar to?
AA video file
BA spreadsheet with rows and columns
CA photo album
DA text document
✗ Incorrect
A database table organizes data like a spreadsheet with rows and columns.
What happens when you run your first SQL query?
ANothing happens
BThe database deletes all data
CThe database crashes
DThe database shows the data you asked for
✗ Incorrect
Running a query asks the database to find and show the requested data.
Explain what happens when you run your first SQL query.
Think about how the database processes your command and shows you data.
You got /3 concepts.
Describe the role of the SELECT statement in SQL.
Focus on what <code>SELECT</code> does in a query.
You got /3 concepts.
Practice
(1/5)
1. What does the SELECT statement do in MySQL?
easy
A. It retrieves data from a database table.
B. It deletes data from a database table.
C. It updates data in a database table.
D. It creates a new database table.
Solution
Step 1: Understand the purpose of SELECT
The SELECT statement is used to get or read data from a table in a database.
Step 2: Compare with other SQL commands
DELETE removes data, UPDATE changes data, and CREATE makes new tables, so they are different from SELECT.
Final Answer:
It retrieves data from a database table. -> Option A
Quick Check:
SELECT = retrieve data [OK]
Hint: SELECT means get data from a table [OK]
Common Mistakes:
Confusing SELECT with DELETE or UPDATE
Thinking SELECT creates tables
Mixing SELECT with data modification commands
2. Which of the following is the correct syntax to select all columns from a table named users?
easy
A. SELECT users FROM *;
B. SELECT * FROM users;
C. SELECT * users FROM;
D. FROM users SELECT *;
Solution
Step 1: Recall the basic SELECT syntax
The correct syntax to get all columns is: SELECT * FROM table_name;
Step 2: Check each option
SELECT * FROM users; matches the correct syntax. Others have wrong order or misplaced keywords.
Final Answer:
SELECT * FROM users; -> Option B
Quick Check:
SELECT * FROM table_name; is correct [OK]
Hint: SELECT * FROM table_name; gets all columns [OK]
Common Mistakes:
Swapping SELECT and FROM keywords
Omitting the FROM keyword
Placing * in wrong position
3. Given a table products with columns id, name, and price, what will this query return?
SELECT name FROM products;
medium
A. All product names from the products table.
B. All product prices from the products table.
C. All columns from the products table.
D. An error because price column is missing.
Solution
Step 1: Understand the SELECT clause
The query selects only the 'name' column from the products table.
Step 2: Check what is returned
It returns all rows but only the 'name' column values, not price or id.
Final Answer:
All product names from the products table. -> Option A
Quick Check:
SELECT name returns names only [OK]
Hint: SELECT column_name returns that column's data [OK]
Common Mistakes:
Assuming all columns are returned
Thinking missing columns cause errors
Confusing column names in SELECT
4. What is wrong with this query?
SELECT FROM users;
medium
A. FROM keyword should be after WHERE.
B. Table name is incorrect.
C. Missing column names or * after SELECT.
D. SELECT cannot be used with FROM.
Solution
Step 1: Check the SELECT syntax
SELECT must be followed by column names or * to specify what to retrieve.
Step 2: Identify the error in the query
The query has SELECT but no columns or * after it, causing a syntax error.
Final Answer:
Missing column names or * after SELECT. -> Option C
Quick Check:
SELECT needs columns or * [OK]
Hint: Always specify columns or * after SELECT [OK]
Common Mistakes:
Leaving SELECT empty
Misplacing FROM keyword
Thinking FROM is optional
5. You want to see all columns from a table employees but only for employees with the job title 'Manager'. Which query should you use?
hard
A. SELECT * WHERE job_title = 'Manager' FROM employees;
B. SELECT job_title FROM employees WHERE job_title = 'Manager';
C. SELECT * FROM employees;
D. SELECT * FROM employees WHERE job_title = 'Manager';
Solution
Step 1: Identify the need to filter rows
We want all columns but only rows where job_title is 'Manager', so we need a WHERE clause.
Step 2: Check query syntax and logic
SELECT * FROM employees WHERE job_title = 'Manager'; correctly uses SELECT * FROM employees WHERE job_title = 'Manager'; which returns all columns filtered by job title.
Final Answer:
SELECT * FROM employees WHERE job_title = 'Manager'; -> Option D
Quick Check:
Use WHERE to filter rows [OK]
Hint: Use WHERE to filter rows after FROM [OK]
Common Mistakes:
Omitting WHERE clause for filtering
Placing WHERE before FROM
Selecting only job_title instead of all columns
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.