Select the course system and count how many credits a student has selected
Selected Course Table info_selected
Field type
stu_id varchar (50)
Course_idint (11)
Student Table Info_student
Field type grooming property null default extra action
Idvarchar (GB2312_CHINESE_CI) No
Namevarchar (GB2312_CHINESE_CI) No
Deptvarchar (+) Gb2312_chinese_ci No
Majorvarchar (+) Gb2312_chinese_ci No
Sexchar (4) Gb2312_chinese_ci No
Classvarchar (GB2312_CHINESE_CI) No
Passwordvarchar (gb2312_chinese_ci) No e10adc3949ba59abbe56e057f20f883e
Timetable Info_course
Field type grooming property null default extra action
Idint (5) No auto_increment
Novarchar (GB2312_CHINESE_CI) No
Namevarchar (GB2312_CHINESE_CI) No
Teacher_idvarchar (GB2312_CHINESE_CI) No
Teacher_namevarchar (GB2312_CHINESE_CI) No
Selectedmanint (11) is 0
Capacityint (11) is null
Timevarchar (GB2312_CHINESE_CI) is null
Placevarchar (GB2312_CHINESE_CI) is null
Creditfloat is null
Count the total number of credits a student has chosen
How do you write this statement?
------Solution--------------------
SQL code
select y.stuid,sum (A.credit) from curriculum A, student table S, selected course y whe
Re y.course_id=a.id GROUP by y.stu_id
------Solution--------------------
2 Floor Less an association
SQL code
select a.name,sum (b.credit) from student table A, curriculum B, selection timetable cwhere a.id = c.stu_id and b.id = C.COURSE_ID GROUP by c.stu_id