0
点赞
收藏
分享

微信扫一扫

Shell编程之函数

其生 2024-06-19 阅读 25

查询所有列

select * from user_profile;

查询多列

想要用户的设备id对应的性别、年龄和学校的数据

select `device_id`,`gender`,`age`,`university` from user_profile;

查询结果去重

查看用户来自于哪些学校,请从用户信息表中取出学校的去重数据

select  distinct `university` from user_profile;

查询结果限制返回行数

只需要查看前2个用户明细设备ID数据,请你从用户信息表 user_profile 中取出相应结果。

select `device_id` from user_profile order by id limit 2;

将查询后的列重新命名

需要查看前2个用户明细设备ID数据,并将列名改为 'user_infos_example',,请你从用户信息表取出相应结果

select `device_id` from user_profile as `user_infos_example` order by id limit 2;
举报

相关推荐

0 条评论