【Tips】
NULL值之苏格兰议会练习链接:
SELECT name FROM msp WHERE party IS NULL
SELECT name,Leader FROM party
SELECT name,Leader FROM party WHERE Leader IS NOT NULL
SELECT party.name FROM party JOIN msp ON Code=Party GROUP BY party.name HAVING COUNT(party.name)>=1
SELECT msp.name,party.name FROM msp LEFT JOIN party ON Party=Code ORDER BY msp.name
SELECT party.name,COUNT(msp.name) FROM msp LEFT JOIN party ON Party=Code WHERE Party IS NOT NULL GROUP BY party.name
SELECT party.name,COUNT(msp.name) FROM msp RIGHT JOIN party ON Party=Code GROUP BY party.name
原文:https://www.cnblogs.com/tuzinn/p/13876938.html