0
0
SQLquery~5 mins

SELECT specific columns in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ASELECT
BWHERE
CFROM
DINSERT
What does SELECT * do?
ASelects all rows but no columns
BSelects all columns from the table
CDeletes all data
DUpdates all columns
How do you select only the 'email' column from a table named 'users'?
ASELECT email FROM users;
BSELECT * FROM users WHERE email;
CSELECT users FROM email;
DSELECT email WHERE users;
Why is it better to select specific columns instead of using SELECT *?
AIt makes queries slower
BIt changes the table structure
CIt returns less data and improves performance
DIt deletes unnecessary columns
Which of these is a valid SQL query to select columns 'id' and 'name' from 'employees'?
ASELECT id name FROM employees;
BSELECT employees FROM id, name;
CSELECT * id, name FROM employees;
DSELECT id, name FROM employees;
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.