Question

uestion-4 The relational database schema of Question-3 is reproduced here. COURSE (NUMBER, TITLE, ENROLLED) RANK-1 (CNUMBER, R1-SSN) RANK-2 (CNUMBER, R2-SSN) TALLEST (CNUMBER, TALL-SSN) STUDENT (SSN, NAME, MAJOR, SEX, GPA) Formulate the following queries in soL. (30] (a) List the course numbers in which Jack Hernandez is the first ranked student. You are not allowed to use any JOIN operation and your answer must be in alphabetical order of the course titles two top ranked students number of courses where she was ranked first in class, and the Average number of students (b) For every course that enrolls at least 20 students, list the Course title, and the names of its (c) For each student that ranked first in at least three courses, specify the students SSN, the enrolled in those classes (d) List the Course number and the top ranked students SSN for all courses where the top ranked student is also the tallest in class. You are not allowed to use the WHERE clause and the JOIN operation in your answer Can someone please help me solve the following database management question a - d please help
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please note that there is no records given for the tables so it is not possible to provide sample output. Below are the answers:

a.
select number from course where number in (select cnumber from rank-1 where r1-ssn in (select ssn from student where name = 'Jack Hernandez')) order by title;

b.
select '1' as rank,c.title,s.name from course c
join rank-1 r1
on c.number=r1.cnumber
join student s
on r1.r1-ssn=s.ssn
where c.number in (
select cnumber from
(select cnumber,count(rnk) cnt from
(select cnumber,r1-ssn rnk from rank-1
union
select cnumber,r2-ssn rnk from rank-2) course_all
group by cnumber) a
where cnt >=20)
union
select '2' as rank,c.title,s.name from course c
join rank-2 r2
on c.number=r2.cnumber
join student s
on r2.r2-ssn=s.ssn
where c.number in (
select cnumber from
(select cnumber,count(rnk) cnt from
(select cnumber,r1-ssn rnk from rank-1
union
select cnumber,r2-ssn rnk from rank-2) course_all
group by cnumber) a
where cnt >=20)

c.
select s.ssn,x.cnt,x.avg_enrl
from
(select a.r1-ssn,a.cnt,avg(c.enrolled) avg_enrl
from
(select r1.r1-ssn,r1.cnt,rnk1.cnumber
from
(select r1-ssn,count(cnumber) cnt
from rank-1
group by r1-ssn
having count(cnumber) >=3) r1
join rank-1 rnk1
on r1.r1-ssn=rnk1.r1-ssn) a
join course c
on a.cnumber=c.number
group by a.r1-ssn,a.cnt) x
join student s
on x.r1-ssn=s.ssn

d.
select cnumber,r1-ssn
from rank-1
intersect
select cnumber,tall-ssn
from tallest

Add a comment
Know the answer?
Add Answer to:
Can someone please help me solve the following database management question a - d please help...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A University database contains information about students (identified by social security number, or SSN) and courses...

    A University database contains information about students (identified by social security number, or SSN) and courses (identified by courseid). Students enroll in courses; each of the following situations concerns the Enrolls-In relationship set. For each situation, draw an ER diagram that describes it (assuming no further constraints hold). 1.Students can enroll in the same course in several semesters, and each offering must be recorded. 2. Students can enroll in the same course in several semesters, and only the most recent...

  • Consider the following database and answer the questions below. a) Write the SQL statement the displays...

    Consider the following database and answer the questions below. a) Write the SQL statement the displays the names of the students who have enrolled in the Database Systems course b) Write the SQL statement that displays a list of the students whose names start with 'S' c) Write the SQL statement that displays the Student ID, Student Name, Course ID, and Grade for students that passed at least one course with a grade better than B+ (i.e. A-, A, and...

  • 2. Consider the following database and answer the questions below SPORT ENROLLMENT STUDENT COURSE ST ST...

    2. Consider the following database and answer the questions below SPORT ENROLLMENT STUDENT COURSE ST ST TITLE 313 1313 50s0 Basketbal 8989 Basketbal 007 COMP203A 7007 COMP20e 007 ames Bond 302 Database Systems COMP203 Computer Or n Brown 00 CoMP302 A o0 3un SmuCOMP42daedDatabase Systems 3 13 COMP 209 70 5050 Susan Smith COMP447 nced Database S 1313 COMP2O3A 1313 COMP302 5050 COMP20 C 1313 COMP42 7007 Write the SQL statement that displays the names of the students who have...

  • DO NOT COPY AND PASTED!!!!!!!!!!!!! IF YOU DO NOT HOW TO DO IT, JUST DO NOT...

    DO NOT COPY AND PASTED!!!!!!!!!!!!! IF YOU DO NOT HOW TO DO IT, JUST DO NOT ANSWER MY QUESTIONS package scheduler; import java.util.List; public class Scheduler { /** * Instantiates a new, empty scheduler. */ public Scheduler() { } /** * Adds a course to the scheduler. * * @param course the course to be added */ public void addCourse(Course course) { } /** * Returns the list of courses that this scheduler knows about. * * This returned object...

  • database management system

    Design a “good” entity-relationship diagramthat describes the following objects in an university application:students, instructors, professors, and courses.Students aresubdivided into graduate and undergraduate students. Students takea course in a particular semester and receive a grade for theirperformance. Sometimesstudents take the same course again in adifferent semester. There are no limits on how many courses astudent can take, and on how many students completed aparticularcourse. Each graduate student has exactly one advisor, who must bea professor, whereas each professor is allowed to...

  • Create sql queries to find the following miscrosoft access compatible commands please 9. Courses for which...

    Create sql queries to find the following miscrosoft access compatible commands please 9. Courses for which at least three students earned a grade of A, showing the grade and the course code 10. Semesters when the highest number of courses have been scheduled, showing the semester name and the number of sections 11. (Extra) Professors that are not students, and students that are not professors, showing their ID and SSN 12. (Extra) Semesters for which all courses are taught by...

  • Someone please answer all of these. I need these badly. The submission date is knocking at...

    Someone please answer all of these. I need these badly. The submission date is knocking at the door. Experiment 1: SQL data definition and data insertion 46 hours) 1. CREATE TABLE. The database schema consists of the three relations, whose schemas are: S (Spa, Sname. Sgender, Sage, Sdert? // students(SID, name, gender, age, department) SC (Spa, Cne. Grade) //Course(SID, CID, grade) C (One Cname Crno. Ceredit) l/courses (CID, course name, prerequisite courses, credit) 2. DROP TABLE, ALTER TABLE, CREATE INDEX,...

  • How to complete this methods: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.time.Loc...

    How to complete this methods: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.time.LocalDate; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; /** * Utility class that deals with all the other classes. * * @author EECS2030 Summer 2019 * */ public final class Registrar {    public static final String COURSES_FILE = "Courses.csv";    public static final String STUDENTS_FILE = "Students.csv";    public static final String PATH = System.getProperty("java.class.path");    /**    * Hash table to store the list of students using their...

  • You are asked to build and test the following system using Java and the object-oriented concepts ...

    You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT