Recall & Review
beginner
What does the SQL SELECT statement do?
The SELECT statement retrieves data from a database table. You can choose to get all columns or specific columns.
Click to reveal answer
beginner
How do you select only the 'name' and 'age' columns from a table called 'people'?
Use:
SELECT name, age FROM people; This returns only the 'name' and 'age' columns for all rows.Click to reveal answer
beginner
What happens if you use
SELECT * in a query?It selects all columns from the table, returning every column for each row.
Click to reveal answer
beginner
Why might you want to select specific columns instead of all columns?
Selecting specific columns reduces the amount of data returned, making queries faster and easier to read.
Click to reveal answer
beginner
Write a SQL query to select the columns 'product_id' and 'price' from a table named 'products'.
The query is:
SELECT product_id, price FROM products;Click to reveal answer
Which SQL keyword is used to choose specific columns from a table?
✗ Incorrect
The SELECT keyword is used to specify which columns to retrieve.
What does
SELECT * do?✗ Incorrect
SELECT * returns every column for each row in the table.How do you select only the 'email' column from a table named 'users'?
✗ Incorrect
The correct syntax is
SELECT email FROM users; to get only the email column.Why is it better to select specific columns instead of using
SELECT *?✗ Incorrect
Selecting specific columns reduces data size and speeds up query results.
Which of these is a valid SQL query to select columns 'id' and 'name' from 'employees'?
✗ Incorrect
Option D uses correct syntax to select specific columns.
Explain how to select specific columns from a table in SQL and why it is useful.
Think about choosing only what you need from a list.
You got /4 concepts.
Write a SQL query to get the 'title' and 'author' columns from a 'books' table.
Use the format: SELECT columns FROM table;
You got /4 concepts.