学习Unity3D之高级查询。

欢迎来到unity学习unity培训unity企业培训教育专区,这里有很多U3D资源U3D培训视频U3D教程U3D常见问题U3D项目源码,我们致力于打造业内unity3d培训、学习第一品牌。1、多表联结查询—分类。
  1)内联结(inner join)
       select u.name,s.grade from score as s inner join users as u on s.uid=u.id
  2)外联结     
           ——左外联结(left join)(跟表的位置有关)
           select u.name,s.grade from score as s left join users as u on s.uid=u.id   //会忽略score中grade为空的行。
           select u.name,s.grade from users as u  left join score as s on s.uid=u.id    //会显示score中grade为空的行。
           ——右外联结(right join)(跟表的位置有关)
select u.name,s.grade from score as s right join users as u on s.uid=u.id //会显示score中grade为空的行。
           select u.name,s.grade from users as u  right join score as s on s.uid=u.id    //会忽略score中grade为空的行。
2、模糊查询—like:查询时,字段中的内容并不一定与查询内容完全匹配,只要字段中含有这些内容。
       select id,name from users where name like '%a%'   代表字段中带有a的。
3、模糊查询—between...and:把某一字段中内容在特定范围内的记录查询出来。
       select id,name from users where id between 1 and 2
       select id,name from users where id >=1 and id<=2
4、模糊查询—in:把某一字段中内容与所列出的查询内容列表匹配的记录查询出来。
       select id,name from users where id in(1,2,3)
5、聚合函数。
  1)sum:select sum(id) as 总和 from users     //整个表中id的总和。
  2)avg:select avg(id) as 平均 from users     //整个表中的平均数。
  3)max:select max(id) as 最大,min(id) as 最小 from users   
  4)count:
       select count(*) as 总人数 from users
       select count(password) as 总人数 from users
6、分组。
       select id,avg(id) as 平均 from users group by id
       select id,avg(id) as 平均 from users group by id,name

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值