What does the SQL query SELECT * FROM table_name; do?
It selects and returns all columns and all rows from the table named table_name.
Click to reveal answer
beginner
In SQL, what symbol is used to select all columns from a table?
The asterisk symbol * is used to select all columns.
Click to reveal answer
intermediate
Why might you want to avoid using SELECT * in large databases?
Because it returns all columns, which can be slow and use more resources if the table has many columns or rows. Selecting only needed columns is more efficient.
Click to reveal answer
beginner
Write a SQL query to select all columns from a table named employees.
SELECT * FROM employees;
Click to reveal answer
beginner
What is the difference between SELECT * and SELECT column1, column2?
SELECT * returns all columns, while SELECT column1, column2 returns only the specified columns.
Click to reveal answer
What does the asterisk (*) mean in the SQL query SELECT * FROM customers;?
ASelect all columns from the customers table
BSelect all rows from the customers table
CSelect only the first column from the customers table
DDelete all data from the customers table
✗ Incorrect
The asterisk (*) means select all columns from the specified table.
Which SQL query selects all columns from the table named orders?
ASELECT columns FROM orders;
BSELECT all FROM orders;
CSELECT * FROM orders;
DSELECT orders.*;
✗ Incorrect
The correct syntax to select all columns is SELECT * FROM table_name;
If you want to select only the columns 'name' and 'age' from a table, which query is correct?
ASELECT * FROM table_name;
BSELECT name AND age FROM table_name;
CSELECT name age FROM table_name;
DSELECT name, age FROM table_name;
✗ Incorrect
To select specific columns, list them separated by commas after SELECT.
What is a potential downside of using SELECT * in a query?
AIt only returns one row
BIt can slow down the query by returning unnecessary data
CIt deletes data from the table
DIt requires specifying column names
✗ Incorrect
Selecting all columns can return more data than needed, slowing down performance.
Which part of the SQL query specifies the table to select data from?
AFROM
BWHERE
CSELECT
DORDER BY
✗ Incorrect
The FROM clause specifies the table to select data from.
Explain how to select all columns from a table in SQL and why you might want to be careful using it.
Think about the * symbol and performance.
You got /4 concepts.
Write a simple SQL query to get all data from a table called 'products'.
Use the wildcard * to select all columns.
You got /3 concepts.
Practice
(1/5)
1. What does the SQL query SELECT * FROM employees; do?
easy
A. It deletes all data from the employees table.
B. It creates a new employees table.
C. It updates all columns in the employees table.
D. It retrieves all columns and all rows from the employees table.
Solution
Step 1: Understand the SELECT * syntax
The asterisk (*) means select all columns from the specified table.
Step 2: Apply to the employees table
The query fetches every column and every row from the employees table.
Final Answer:
It retrieves all columns and all rows from the employees table. -> Option D
Quick Check:
SELECT * = all columns and rows [OK]
Hint: SELECT * means get everything from the table [OK]
Common Mistakes:
Thinking SELECT * deletes or updates data
Confusing SELECT * with creating tables
Assuming it selects only one column
2. Which of the following is the correct syntax to select all columns from a table named products?
easy
A. SELECT * FROM products;
B. SELECT products.*;
C. SELECT columns FROM products;
D. SELECT ALL FROM products;
Solution
Step 1: Recall the correct SELECT syntax
The correct way to select all columns is using SELECT * FROM table_name.
Step 2: Check each option
SELECT * FROM products; matches the correct syntax exactly.
Final Answer:
SELECT * FROM products; -> Option A
Quick Check:
SELECT * FROM table = correct syntax [OK]
Hint: Use SELECT * FROM table_name to get all columns [OK]
Common Mistakes:
Using SELECT ALL instead of SELECT *
Forgetting FROM keyword
Trying to select 'columns' literally
3. Given the table students with columns id, name, and age, what will the query SELECT * FROM students WHERE age > 20; return?
medium
A. All students regardless of age.
B. Only the age column for students older than 20.
C. All columns for students whose age is greater than 20.
D. An error because * cannot be used with WHERE.
Solution
Step 1: Understand SELECT * with WHERE clause
SELECT * fetches all columns, and WHERE filters rows based on condition.
Step 2: Apply condition age > 20
Only rows where age is greater than 20 are returned, with all columns shown.
Final Answer:
All columns for students whose age is greater than 20. -> Option C
Quick Check:
SELECT * + WHERE filters rows [OK]
Hint: SELECT * returns all columns; WHERE filters rows [OK]
Common Mistakes:
Thinking WHERE limits columns instead of rows
Assuming * selects only one column
Believing * cannot be used with WHERE
4. Identify the error in this SQL query: SELECT * employees;
medium
A. Table name should be in quotes.
B. Missing FROM keyword before table name.
C. Using * is not allowed in SELECT.
D. SELECT cannot be used without WHERE.
Solution
Step 1: Check SQL SELECT syntax
The correct syntax requires FROM before the table name.
Step 2: Identify missing keyword
The query misses FROM between SELECT * and employees.
Final Answer:
Missing FROM keyword before table name. -> Option B
Quick Check:
SELECT * FROM table is correct syntax [OK]
Hint: Always use FROM before table name in SELECT [OK]
Common Mistakes:
Omitting FROM keyword
Thinking * is invalid
Adding unnecessary quotes around table name
5. You want to quickly check all data in a large table named orders. Which query is best to avoid slowing down your database?
hard
A. SELECT * FROM orders LIMIT 10;
B. SELECT * FROM orders;
C. SELECT order_id FROM orders;
D. DELETE FROM orders WHERE order_id < 10;
Solution
Step 1: Understand SELECT * impact on large tables
SELECT * fetches all rows and columns, which can be slow on big tables.
Step 2: Use LIMIT to reduce rows fetched
Adding LIMIT 10 fetches only 10 rows, making the query faster and safer.
Final Answer:
SELECT * FROM orders LIMIT 10; -> Option A
Quick Check:
LIMIT reduces rows, speeding up SELECT * [OK]
Hint: Use LIMIT with SELECT * on big tables to speed queries [OK]
Common Mistakes:
Running SELECT * without LIMIT on large tables
Confusing DELETE with SELECT
Selecting only one column when all data is needed
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.