2,619
次編輯
Tankianting(討論 | 貢獻) |
Tankianting(討論 | 貢獻) |
||
行 1: | 行 1: | ||
{{Nav|程式語言、邏輯學}} | {{Nav|程式語言、邏輯學}} | ||
==SQL Pocket Guide的一些記錄== | ==SQL Pocket Guide的一些記錄== | ||
===Ch1 | ===Ch1-Ch4=== | ||
*SQL分成: | *SQL分成: | ||
行 51: | 行 51: | ||
*句子sentence、子句clause | *句子sentence、子句clause | ||
select database.table.id from database.table altername | |||
select id, ... , (select avg(population) from county ) as average.pop ... #子查詢subquery | |||
如果子查詢和外部表格欄位關聯,則應用join,以提升效能。 | |||
select o.id, o.name, | |||
count(o.is) as num_waterfalls, | |||
from owner o left join waterfalls w, o 為別名 | |||
on o.id = w.owner_id | |||
group by o.id, o.name | |||
select all x,y from ... where... | |||
select id, name from 學生清單; | select id, name from 學生清單; |