10.29Mysql作业题


SELECT* FROM t_book WHERE book_copy IN(5,6,7);
SELECT* FROM t_press WHERE press_address LIKE'%北京%';
SELECT* FROM t_reader WHERE reader_borrowtotal IS NULL LIMIT 2,4;
SELECT AVG (YEAR(CURDATE())-YEAR(reader_birthday)) AS 平均年龄, MIN(YEAR(CURDATE())-YEAR(reader_birthday)) AS 最小年龄, MAX(YEAR(CURDATE())-YEAR(reader_birthday))AS 最大年龄, COUNT(reader_id) AS 读者人数 FROM t_reader;

作业题:

图片来源:嘉杰
正确作业代码班上同学已经发在班级群里,我这个不一定正确,我主要分享这两张表✌️
/*SELECT *,borndate FROM student WHERE GradeId="1" */ SELECT * FROM student WHERE GradeId=1 ORDER BY borndate;
SELECT * FROM result WHERE SubjectNo=1 ORDER BY StudentResult DESC;
SELECT StudentNo,studentResult FROM result WHERE ExamDate='2016-02-17' ORDER BY studentresult DESC LIMIT 5;
SELECT COUNT(*),borndate FROM student GROUP BY YEAR(BORNDATE) HAVING COUNT(*)>=2
SELECT studentName,FLOOR(DATEDIFF(NOW(),bornDate)/365) FROM student WHERE sex='女' ORDER BY bornDate DESC LIMIT 1,7;
SELECT MAX(studentresult),MIN(studentresult),MAX(studentresult) FROM result WHERE examDate='2016-02-17';
两张数据库表打包下载:
符攀飞 符攀飞
大约 3 年前
501

扫描下方二维码手机阅读文章

0 0