找回密码
 立即注册

推荐阅读

  • 便民服务
  • 关注我们
  • 社区新手
5.3 笔记
   

硬连接:机械的追加,两个表的字段数量必须要一样,以前面表的字段为准
select * from aa union select * from cc;
临时表:select * from aa,cc where aa.id=cc.s_id;
select score from (select * from aa,cc where aa.id=cc.s_id) yy where name=''
嵌套方法(=):用在只有一个值的情况下
select id from aa where name='s';
select score from cc where s_id=(select id from aa where name='s');
嵌套方法(in):用在字段值多个选择的情况,in可以包括=,但是=不能包括in
select id from aa where name='s'
select score from cc where s_id in (select id from aa where name='s');
做题的步骤:
1.拿出题干要求的字段
2.检查这几个字段分别分布在几张表里,一张表直接输出;如果是多张表,直接拼接
3.根据条件筛选,整理句式
遇到每个就分组,group by xxx
where 与 having的位置,两个不能同时出现

分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册