#查询结果去重#
distinct 关键字select distinct university from user_profile distinct去重,放在列的前面使用
#将查询后的列重新命名#及限制返回行数
select device_id as user_infors_example from user_profile limit 0,2;
#查找某个年龄段的用户信息#
between 在列值得某与某之间
select device_id,gender,age,university from user_profile WHERE age between 20 and 23
#用where过滤空值练习#
把age是null值筛选出来
selectdevice_id,gender,age,universityfrom user_profileWHEREage is not null
#Where in 和Not in#
这主要是用标题的两个关键字中的一个 in(字段...) 包含条件的字段,not in(字段..) 除字段以外的
推荐用in ,增加复用性
select device_id,gender,age,university,gpa from user_profile
where university in('北京大学','复旦大学','山东大学');