Home > database >  SQL query problem, using mysql or oracle statements, preferably oracle
SQL query problem, using mysql or oracle statements, preferably oracle

Time:09-23

Database contains the following tables, carefully check the table of the relationship between

StudentInfo (student information)

StudentID StudentName Sex

Stu001 zhang fei men

Stu002 liu bei men

Stu003 guan yu men

Stu004 little women



CourseInfo information table (course)

CourseID CourseName

Cou001 Chinese

Cou002 mathematical

Cou003 English



StudentScores (grades)

Id StudentID CourseID Scores

SS001 Stu001 Cou001 82

SS002 Stu002 Cou001 78

SS003 Stu002 Cou002 95

SS004 Stu003 Cou001 85

SS005 Stu003 Cou002 90

SS006 Stu003 Cou003 100

SS007 Stu004 Cou001 70

SS008 Stu004 Cou002 60

SS009 Stu004 Cou003 73

1. Query all the students' language result (CourseID="Cou001"), and in accordance with the order of the Scores from high to low rank, the query results should include StudentID, CourseID, Scores three column information,

2. To use an SQL statement list each student average score, the query results should include StudentID, Scores information,

3. Use an SQL statement list gender for participants in grades, the query results should include StudentID, StudentName, Sex, CourseName, Scores information,

4. Use a SQL query out every class is more than 80 points, the student's name,

5. Because StudentScores primary keys are missing, resulting in a lot of duplicate data, please arrange all duplicate records in this table only keep one, does not require an SQL statement is used to implement,
  • Related