Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction This assignment will use a database containing data about a university. The relations are provided to you in a separate script file (available on

Introduction This assignment will use a database containing data about a university. The relations are provided to you in a separate script file (available on the course website). Create a database called university and then run the script in university-db file. Before you start writing SQL, it is a good idea to take a look at the database and familiarize yourself with its contents. The schema of the database is provided below (primary keys are in bold, field types are omitted): student(sid, sname, sex, age, year, gpa) dept(dname, numphds) prof(pname, dname) course(cno, cname, dname) major(dname, sid) section(dname, cno, sectno, pname) enroll(sid, grade, dname, cno, sectno) Queries Write SQL queries that answer the questions below (one query per question), run them on MySQL, and include the answers in your report. The query answers must not contain duplicates, but you should use the SQL keyword distinct only when necessary. Questions Write the following SQL queries:Using natural joints 1. Print the names of professors who work in departments that have fewer than 50 PhD students. 2. Print the name(s) of student(s) with the lowest gpa. 3. For each Computer Sciences class, print the cno, sectno, and the average gpa of the students enrolled in the class. 4. Print the course names, course numbers and section numbers of all classes with less than six students enrolled in them. 5. Print the name(s) and sid(s) of the student(s) enrolled in the most classes. 6. Print the names of departments that have one or more majors who are under 18 years old. 7. Print the names and majors of students who are taking one of the College Geometry courses. (Hint: You'll need to use the "like" predicate and the string matching character in your query.) 8. For those departments that have no majors taking a College Geometry course, print the department name and the number of PhD students in the department. 9. Print the names of students who are taking both a Computer Sciences course and a Mathematics course. 10. For each department that has one or more majors with a GPA under 1.0, print the name of the department and the average GPA of its majors.

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

b. Will new members be welcomed?

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago