In操作符
SELECT * FROM Artist a where a.Name IN ('AC/DC','Accept');
表示查找name = 'AC/DC' 或 'Accept'的數據
相當于
select * from Artist where name='AC/DC' or name='Accept';
字段設置別名
image.png
多表查詢
image.png
left join 以左表為基準 LEFT JOIN 關鍵字從左表(Websites)返回所有的行,即使右表(access_log)中沒有匹配。
right join 以右表為基準 RIGHT JOIN 關鍵字從右表(Websites)返回所有的行,即使左表(access_log)中沒有匹配。
selft * from table1 join table2 on table1.id = table2.id
如果沒匹配上 就會返回空的列表。
image.png
select DISTINCT(mt2.Name) as aName FROM MediaType mt2 order by mt2.MediaTypeId desc;