CS186-L1: Introduction + SQL I
Contents
大纲进程: sheet
SQL I
pros and cons
relational Terminology and concepts
- database: set of name relations
- relation(table):
- schema: descriptions “metadata”
- fixed, unique attribute names, atomic types
- instance: set of data 符合description
- often changed, can duplicate
- multiset of tuples or “rows”
- schema: descriptions “metadata”
- attribute (column,field)
- tuple (row,record),怀疑一些python概念也来自于此
DDL (Data Definition Language)
|
|
|
|
ORDER BY
Lexicographic order by default 字典序
LIMIT
Aggregation functions
- AVG: average
- COUNT: count the number of rows
- MAX: maximum value
- MIN: minimum value
- SUM: sum of values
|
|
GROUP BY
HAVING
|
|
不同的DISTINCT位置效果不同, 其中第二个压根没用