Remeber
Do not ever use lowercase letter for query
- It works, but it is hard to read
Space, enter doesn’t affect to query
- You can use one query per line if you want.
Example
SELECT names FROM customers
Queries
SELECT name FROM customers
- Gets name column from customers table
SELECT name,zip FROM customers
- Gets name and zip columns from customers table
- You can get multiple columns by using commas
SELECT * FROM customers
- Gets all columns from customers table
SELECT DISTINCT state FROM customers
- Gets only one time for same value(No duplicate)
SELECT id, name FROM customers LIMIT 5
- Gets first 5 items
SELECT id, name FROM customers LIMIT 5,10
- From 5 , gets 10 items
- First 5 is just as index, so it starts from 0
- In here, you will start getting from 6th item