Answered step by step
Verified Expert Solution
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 studentid name, departmentid studentGradeAverage
Take sid cid, grade coursetake studentid coursecode, grade
Course cid title, credits, did, avgGrade course coursecode, name, credits, departmentid courseGradeAverage
Department did name, avgGrade department departmentid name, departmentGradeAverage
Teacher tid name, did, avgGrade teacher teacherid name, departmentid courseCount
Teach tid cid courseteach teacherid coursecode
Using the above database schema, write the following questions in SQL:
List the sid and grades grade of the student named 'Ali KURT' name
List the records of the courses ie all columns of the course table taken by the student named Aye KURT' name but not taken by the student named 'Ali KURT'.
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
List the sids of teachers who teach more than courses, the number of courses they teach, and the number of students taking their courses.
List the records list all fields of the student table of the students from the 'Computer Eng' departmentname department who take courses from the 'Electrical Eng' departmentname 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, ie 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 tableMeaning 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started