Auto commit

This commit is contained in:
2025-02-27 10:34:54 +08:00
parent d59764c856
commit 669136154c
+30 -1
View File
@@ -407,16 +407,45 @@ FROM (
)s3;
#19.
SELECT c.`name`, COUNT(*)
FROM courses c
LEFT JOIN scores sc ON sc.course_id = c.id
GROUP BY c.id;
#20.
SELECT st.id, st.`name`
FROM students st
WHERE (
SELECT COUNT(*)
FROM scores sc
WHERE sc.student_id = st.id
)=2;
#21.
SELECT st.gender, COUNT(*)
FROM students st
GROUP BY st.gender;
SELECT COUNT(IF(st.gender='', TRUE, NULL)) '男生人数',
COUNT(IF(st.gender='', TRUE, NULL)) '女生人数'
FROM students st;
#22.
SELECT *
FROM students st
WHERE st.`name` LIKE '%风%';
#23.
SELECT s.`name`, s.gender, COUNT(*)
FROM students s
GROUP BY s.`name`, s.gender
HAVING COUNT(*) > 1;
#24. 1990
SELECT *
FROM students s
WHERE YEAR(s.birth) = 1990;
#25.