Structure of the table
Student (s#,sname,sage,ssex) Student table
Course (c#,cname,t#) timetable
SC (s#,c#,score) score table
Teacher (t#,tname) Teacher table
1. Creating the corresponding table CREATE table student (' s# ' int, sname varchar (+), Sage int, s Sex varchar) The following omit 2. Inserting data insert into student Select 1, ' Zhang San ', 18, ' Male ' union ALL select 2, ' John Doe ', 18, ' Male ' Unio n all .... 3. Check the number of all students with "001" courses that are higher than the "002" course; Select a. ' s# ' from SC A,sc b where a. ' C # ' =001 and B. ' C # ' =002 and A.score>b.score ;! [] (http://i2.51cto.com/images/blog/201805/22/696290ad72878304ef70251fbdec2afb.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) 4. Search for students with average scores greater than 60 points and average scores; Select ' s# ', AVG (score) from SC Group BY ' s# ' have avg (score) >60! [] (http://i2.51cto.com/images/blog/201805/22/985a3a24041520bae9be634704eb611c.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) ! [] (Http://i2.51cto.com/images/blog/201805/22/985a3a24041520bae9be634704eb611c.png?x-oss-process=imAge/watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_ zmfuz3pozw5nagvpdgk=)
Record the SQL interview questions you see online and fill in your answers