去重
selECT distinct university from user_profile;
范围between
select device_id , gender,age from user_profile where age between 20 and 23;select device_id , gender,age from user_profile where age >= 20 and age <= 23;
排除某个条件查其他
select device_id,gender,age,university from user_profile where university <> "复旦大学"<>除了select device_id,gender,age,university from user_profile where university not in "复旦大学"select device_id,gender,age,university from user_profile where university != "复旦大学"
排序:order by
默认升序ascselect device_id ,age from user_profile order by ageselect device_id ,gpa,age from user_profile order by gpa ,ageselect device_id ,gpa ,age from user_profile order by gpa, age ascselect device_id ,gpa ,age from user_profile order by gpa asc, age asc降序descselect device_id ,gpa ,age from user_profile order by gpa, age descselect device_id ,gpa ,age from user_profile order by gpa desc, age desc
分组查询:group by
