Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There is a student management database, which contains three schemas: Student(SnoSnameAgeGender), where the attribute represents student id, student name, student age and student gender. Course(CnoCnameTeacher,

There is a student management database, which contains three schemas: Student(SnoSnameAgeGender), where the attribute represents student id, student name, student age and student gender. Course(CnoCnameTeacher, Ccredit), where the attribute represents course

id, course name, teachers name who teaches the course and course credits. SC (SnoCnoMark), where the attribute represents student id, the course id which the student takes and the score for the course. Some of the data saved in the database is as follows:

image text in transcribed

Based on the above relational schema, please write the SQL scripts to do the query in question 1-5, and write the relational algebra expression in question 6-7. Notes: you do not need to give the query results. You only need to give the query script or the relational algebra expression.

1.Query the information of student id, name and age for all students.

2.Find the number of male students(M) and female students(F) respectively, and display the gender and number.

3.Display the course id and course name which is taught by teacher ZHANG.

4.Display the student id and name who does not take the course with id A01.

5.Create a view named VW_Failed for the students who failed (mark

6. Find the teacher who teaches the course Matlab.

7. Find the course-taking information of Peter, which includes student name, course id and mark.

Table1 Student sno sname age 18 gender M 20101 Alex 20102 Bill 17 Carol 20 19 Donald 20103 20104 20105 20106 Peter 18 Tim 17 Table 2 Course cname teacher cno ccredit A01 DS 4 LIU ZHANG A02 DB 3 A03 CHEN 3 A04 Matlab LI 3 Table 3 SC cno mark sno A01 86 20101 20102 20102 A01 70 A02 80 20103 A02 92 20103 75 A04 A03 20104 55

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions