
1. Consider the following relations:
Student (snum: integer, sname: string, major: string, level: string, age: integer)
Class (name: string, meets at: string, room: string, fid: integer)
Enrolled (snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
The meaning of these relations is straightforward; for example, Enrolled has one
record per student-class pair such that the student is enrolled in the class. Level is a
two character code with 4 different values (example: Junior: A Level etc)
Write the following queries in SQL. No duplicates should be printed in any of the
answers.
i. Find the names of all Juniors (level = A Level) who are enrolled in a class
taught by Prof. Kwizera
ii. ii. Find the names of all classes that either meet in room R128 or have five or
more Students enrolled.
iii. Find the names of all students who are enrolled in two classes that meet at
the same time.

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

- SQL Helparrow_forwardWhat does it mean to be related? How do you define a relation's properties?arrow_forward. Students(stulD, lastName, firstName, major, credits) Faculty (facID, name, deptName, rank) • Classes(classNumber, facID, schedule, room) • Enrolls(stulD, classNumber, grade) The primary keys are underlined. The referential integrity constraints are as follows: . the column facID of relation Classes that references table Faculty, . the column stulD of relation Enrolls that references table Students, and the column classNumber of relation Enrolls that references table Classes. The following query is intended to retrieve the number of all classes taught by John Smith in the CST department. However, this query does not work properly. There are at least two faculty members who share the name, John Smith. Briefly explain and show the corrected SQL query_ why. SELECT classNumber FROM Classes WHERE facID= (SELECT facID FROM Faculty WHERE name='John Smith' AND deptName='CST');arrow_forward
- Write a relational calculus based on the following relations: Professor (ProfID, ProfName, DeptNo) Course (CrsID, CrsName, Credits, DeptNo, ProfID) Department (DeptNo, DeptName) Use domain relational calculus; 1. List all course names provided by the department named "Information Technology". 2. List all professor information who work the department named "Information Technology".arrow_forwardSuppose a single relation (table) is used to record the information about students’ enrollment in courses. We assume that each student may enroll in more than one course and one course is assigned to one instructor. All questions below are based on the following ENROLLMENT unnormalized table. ENROLLMENT StudentID StuName CourseCode CourseName Grade CreditHr Instructor InstrOffice 1021234 Ali 1102 1201 Database Internet A B 3 3 Zaid Sumaiya 5.01 5.05 1024131 Amina 1201 1401 Internet Operating System C B 3 3 Sumaiya Abdullah 5.05 5.10 1. What would be the First Normal Form (1NF) relation? Identify the primary key. 2. Identify the functional dependencies represented by the attributes shown in the ENROLLMENT table. Label partial or transitive dependency where applicable.arrow_forwardConsider a relation named as BOOK that contains data about the books in a library. BOOK relation was initially created with the attributes BookID (an id that library assigns), ISBN, CopyNr (used to differentiate copies of the same book), Title, PublYear, Author, and AuthorBornYear. Primary key: BookID, CopyNr and Author Candidate key: ISBN, CopyNr and Author Below you see dependencies of attributes: Dependency 1 (D1): ISBN, Title, PublYear, AuthorBornYear were dependent on BookID, CopyNr and Author Dependency 2 (D2): Title and PublYear were dependent on BookID, CopyNr Dependency 3 (D3): AuthorBornYear was dependent on Author First determine which normal form (1NF, 2NF, 3NF or BCNF) the above relation is, and why. Then, if necessary, convert the above relation to the highest normal form (BCNF). Write any assumptions that you make.arrow_forward
- 7arrow_forwarda) Complete the object conceptual data model for the following relational schema. Branch BranchID Location B001 Shatin ВО02 Homantin Order OrderID SalesTotal BranchID 0001 100 BO01 0002 200 BO02 0003 300 BO01 BranchID is the primary key of Branch table. OrderID is the primary key of Order table. BranchID in Order table is the foreign key references Branch table. Now, assume the OIDS are given below: Branch BranchID Location OID B001 Shatin OID1 B002 Homantin OID2 Order OrderID SalesTotal BranchID OID 0001 100 ВО01 OID3 0002 200 ВО02 OID4 0003 300 ВО01 OID5arrow_forwardQuestion 20 Please fill in the blank correctly.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





