Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Database Schema: Student ( sid , name, did, avgGrade ) / / student ( student - id , name, department - id , studentGradeAverage )

Database Schema:
Student (sid, name, did, avgGrade)// student (student-id, name, department-id, studentGradeAverage)
Take (sid, cid, grade)// course-take (student-id, course-code, grade)
Course (cid, title, credits, did, avgGrade)// course (course-code, name, credits, department-id, courseGradeAverage)
Department (did, name, avgGrade)// department (department-id, name, departmentGradeAverage)
Teacher (tid, name, did, avgGrade)// teacher (teacher-id, name, department-id, courseCount)
Teach (tid, cid)// course-teach (teacher-id, course-code)
Using the above database schema, write the following questions in SQL:
(10) List the sid and grades (grade) of the student named 'Ali KURT' (name).
(10) List the records of the courses (i.e., all columns of the course table) taken by the student named 'Aye KURT' (name) but not taken by the student named 'Ali KURT'.
(10) List the sids of the students and the number of courses they have taken, their average grade, their highest and lowest grades.
List the dids of the departments, the number of students in each department, in descending order of student numbers (Do not use relational algebra).
(10) List the sids of teachers who teach more than 2 courses, the number of courses they teach, and the number of students taking their courses.
(10) List the records (list all fields of the student table) of the students from the 'Computer Eng' (department.name) department who take courses from the 'Electrical Eng' (department.name) department (use the take table).
Find the average number of students per course (from the take table, find how many students take each course, then find the average of these numbers) and list the records of the courses that have more students than this average. (First find the cids of the courses that have more students than the average, then find the course records in the course table based on these cids).
Without using GROUP BY, list the records of students who take two different courses. (Since it's said that students who take two different courses, the take table needs to be used twice! First, find the sids of these students with a subquery, then access the records in the student table, i.e., all columns, based on these sids).
List the teachers who do not teach any courses (meaning there are no records related to this teacher in the teach table).
List the records of the teachers who teach (all columns of the teacher table).(Meaning, list all teachers whose tid appears in the teach table).
NO CHATPGT ANSWER IS ACCEPTABLE, PLEASE .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

A13.4 Which ratios provide information on gearing? (Section 13.3.4)

Answered: 1 week ago

Question

=+Explain the skills needed to create a sustainable personal bran

Answered: 1 week ago