Summary - SELECT basics
- SQL course
- Beginner
- Lesson 6/115
- 5 min
Combine column selection, aliases and literals to write a query.
Summary - SELECT basics
In this group you learned the SELECT basics:
SELECTnames columns,FROMnames the table*picks all columns; otherwise list them by nameASgives columns a result name- Literals and calculations are allowed
Now you will combine these in one query.
Practice Summary - SELECT basics
Select the name column and twice the price aliased as dbl from products.
Starter code
-- write your query
SELECT
FROMSample solution
SELECT name, price * 2 AS cift
FROM productsExpected output
name cift Kalem 10 Defter 24
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which is a valid SELECT query?
- FROM customers SELECT name;
- SELECT name FROM customers; Correct answer
- SELECT name customers;
- customers SELECT name;
Explanation: SELECT comes before FROM.
2 Summary - SELECT basics: match the terms
| Term | Meaning |
|---|---|
SELECT |
choose columns |
FROM |
specify table |
AS |
give alias |
* |
all columns |