1、去重:?distinct
例如;需要對(duì)用戶(hù)信息中的學(xué)校去重;--------SELECT DISTINCT? university FROM user_profile
2、限制:limit
取用戶(hù)ID的前兩行數(shù)據(jù):① SELECT device_id FROM user_profile limit 2 offset 0;-----limit X offset Y(指的是從Y+1行開(kāi)始,選取X行數(shù)據(jù))
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?②SELECT device_id FROM user_profile limit 2;
3、重命名:AS
重命名列名或表格名稱(chēng):select device_id as 'user_infors_example' FROM user_profile LIMIT 2 OFFSET 0;
4、在什么之間:between
求值在XX與XX之間:SELECT device_id,gender,age FROM user_profile WHERE age BETWEEN 20 and 23;
5、不包含:NOT IN
展示除了XX之外的數(shù)據(jù):SELECT device_id, gender, age, university FROM user_profile WHERE university NOT IN('復(fù)旦大學(xué)')