問題 從表中刪除重復記錄. 解決方案 用帶有聚集函數的子查詢, 例如MIN, 任意選擇保留的ID(本例中只保留每組中ID號最小的記錄): delete from dept where id not in (select min(id) from dept group by name)