Overview
SQL, the Structured Introduction
Query Language
DDL Commands
DML Commands
SQL Statements, Operators, Clauses
Aggregate Functions
http://www.cs.sjsu.edu/faculty/lee/cs157b/cs157b.html
1
3/12/2016
2
3/12/2016
SQL Clauses:
Order By Note: that you don't need to use WHERE
Group By
Having
selected.
Sally 28 64 Harry 34 80
George 29 70 Helena 54 54
Example: SELECT * FROM … WHERE …; Helena 54 54 Peter 34 80
Peter 34 80
To get unique rows, type the keyword 3) SELECT distinct weight
2) SELECT weight
DISTINCT after SELECT. FROM person FROM person
Example: SELECT DISTINCT * FROM … WHERE age > 30; WHERE age > 30;
WHERE …; Weight Weight
80 80
54 54
80
3
3/12/2016
4
3/12/2016
MIN(attr) -> return the lowest value from the attr Wikipedia - SQL http://en.wikipedia.org/wiki/SQL
Ex: MIN(sold) from FoodCart; -> 70 Wikipedia - join http://en.wikipedia.org/wiki/Join_(SQL)