网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

SQL group by,between and,union,having

时间:2024-10-12 00:07:33

1、学生表studentCREATETABLE`student`(`id`int(50)NOTNULLAUTO_INCREMENT,`name际吨孔鳝`varchar(50)DEFAULTNULL,`sex`varchar(48)DEFAULTNULL,`age`varchar(50)DEFAULTNULL,`birthday`varchar(50)DEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=245DEFAULTCHARSET=utf8

SQL group by,between and,union,having

3、分组(学生表分组通过班级,查看每班要多少个人)Group bySELECT s.class,COUNT(*) FROM student s GROUP BY s.class

SQL group by,between and,union,having

4、外连接(学生表和课程表,找到2个表直接id一样的学生)SELECT * FROM student s,kecheng k WHERE s.id=k.id

SQL group by,between and,union,havingSQL group by,between and,union,havingSQL group by,between and,union,havingSQL group by,between and,union,havingSQL group by,between and,union,having
© 阿力知识库