person表的字段:

person表中的數據:
查詢:select id,name,sex,age,brithday,address from person;

distinct去除重復:
1.去除重復的name(去除某一個字段重復的記錄)
正確: select distinct name,id,sex,age,brithday,address from person; --distinct只能放在查詢的最前面
錯誤: select id,distinct name,sex,age,brithday,address from person; --出錯,缺失表達式

person表中的數據:
查詢:select id,name,sex,age,brithday,address from person;

distinct去除重復:
1.去除重復的name(去除某一個字段重復的記錄)
正確: select distinct name,id,sex,age,brithday,address from person; --distinct只能放在查詢的最前面
錯誤: select id,distinct name,sex,age,brithday,address from person; --出錯,缺失表達式