Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following schema. CREATE TABLE User Table ( userID CHAR (8), firstName VARCHAR, lastName VARCHAR, email VARCHAR(50), PRIMARY KEY (userID) ); CREATE TABLE Instructor

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Consider the following schema. CREATE TABLE User Table ( userID CHAR (8), firstName VARCHAR, lastName VARCHAR, email VARCHAR(50), PRIMARY KEY (userID) ); CREATE TABLE Instructor instructorID CHAR(8), title VARCHAR, PRIMARY KEY (instructorID), FOREIGN KEY (instructorID) REFERENCES UserTable(userID) ); CREATE TABLE Student student ID CHAR(8), major VARCHAR, PRIMARY KEY (studentID), FOREIGN KEY (studentID) REFERENCES UserTable(userID) ); CREATE TABLE Course ( major VARCHAR, courseNum CHAR(3), title VARCHAR, PRIMARY KEY (major, courseNum) ); CREATE TABLE Prerequisite ( major VARCHAR, courseNum CHAR(3), prereqMajor VARCHAR, prereqCourseNum CHAR(3), PRIMARY KEY (major, courseNum,prereqMajor,prereqCourseNum), FOREIGN KEY (major, courseNum) REFERENCES Course (major, courseNum), FOREIGN KEY (prereqMajor, prereqCourseNum) REFERENCES Course (major,courseNum) ); CREATE TABLE Class ( classID VARCHAR, major VARCHAR NOT NULL, courseNum CHAR (3) NOT NULL, semester VARCHAR(10), year CHAR(4), instructorID CHAR (8) NOT NULL, enrollmentlimit INTEGER, PRIMARY KEY (classID), FOREIGN KEY (major, courseNum) REFERENCES Course (major,courseNum), FOREIGN KEY (instructorID) REFERENCES Instructor(instructorID) CREATE TABLE Enroll ( studentID CHAR(8), classID VARCHAR, grade INTEGER, PRIMARY KEY (classID, studentID), FOREIGN KEY (classID) REFERENCES Class(classID), FOREIGN KEY (studentID REFERENCES Student (studentID) ); CREATE TABLE Assignment ( classID VARCHAR, assignmentNo INTEGER, title VARCHAR, weight INTEGER, deadline DATE, PRIMARY KEY (classID, assignmentNo), FOREIGN KEY (classID) REFERENCES Class(classID) ); CREATE TABLE Submit ( studentID CHAR (8), classID VARCHAR, assignmentNo INTEGER, score INTEGER, submissionDate DATE, PRIMARY KEY (studentID, classID, assignmentNo), FOREIGN KEY (classID, assignment No) REFERENCES Assignment(classID, assignmentNo), FOREIGN KEY (studentID) REFERENCES Student (studentID) ); CREATE TABLE Post ( postID INTEGER, userID CHAR (8) NOT NULL, kind VARCHAR, timestamp DATE, content VARCHAR, popularity INTEGER, PRIMARY KEY (postID), FOREIGN KEY (userID) REFERENCES UserTable(userID) ); CREATE TABLE PostAbout ( postID INTEGER, classID VARCHAR, assignmentNo INTEGER, PRIMARY KEY (postID,classID, assignmentNo), FOREIGN KEY (postID) REFERENCES Post(postID), FOREIGN KEY (classID, assignmentNo) REFERENCES Assignment(classID, assignmentNo) ); You will use the online RelaX relational algebra calculator tool to write the queries. To use the tool, simply go to the link: https://dbis-uibk.github.io/relax/calc/gist/dad302f1c596d5fd2d3dcad0b1d7c410 and type the relational algebra expressions in the textbox. A sample dataset for the above relations will be automatically loaded when you open the above link. In the tool, you can try the queries and check the output. The expected output for each relational algebra expression is also provided. (The Relax tool uses set semantics, so you don't need to remove duplicates) Important note: The sample outputs for the queries are provided to help you test your own solutions. If you include "hard-coded"conditions just to obtain the query output, you won't get any credit for your solution. In your submission: For each query, take a screenshot of the relational algebra expression, the tree, and the output and paste them in a MS Word file. Crop the unnecessary parts of the images to save space. An example is provided in Appendix-A. Make sure to include the parts marked with arrows. 9. Find the classes that are full and overenrolled (i.e., enrollment count is more than the enrollment limit of the class). Return classid, major, courseNum, semester, year, enrollmentlimit of the class and the number of students enrolled. Enroll.classID Class.major Class.courseNum Class.semester Class.year Class.enrollmentlimit num Students 2019501CptS451 Cpts 451 'Spring 2019 8 14 2019S01CptS437 Cpts 437 'Spring 2019 14 14 APPENDIX-A Example output a. Relational Algebra Expression: i firstName, lastName, classID, major, courseNum ((UserTable (userID = instructorID) (o title='Professor' Instructor)) Class) b. Relational algebra tree: I firstName, lastName, dassID, major, courseNum D (userID = instructorID) Class UserTable title="Professor Instructor C. Expression and Output: User Table.firstName User Table.lastName Class.classid Class.major Class.courseNum Diane Cook 2019501Cpts437 Cpts 437 Diane Cook 2020501Cpts437 Cpts 437 Consider the following schema. CREATE TABLE User Table ( userID CHAR (8), firstName VARCHAR, lastName VARCHAR, email VARCHAR(50), PRIMARY KEY (userID) ); CREATE TABLE Instructor instructorID CHAR(8), title VARCHAR, PRIMARY KEY (instructorID), FOREIGN KEY (instructorID) REFERENCES UserTable(userID) ); CREATE TABLE Student student ID CHAR(8), major VARCHAR, PRIMARY KEY (studentID), FOREIGN KEY (studentID) REFERENCES UserTable(userID) ); CREATE TABLE Course ( major VARCHAR, courseNum CHAR(3), title VARCHAR, PRIMARY KEY (major, courseNum) ); CREATE TABLE Prerequisite ( major VARCHAR, courseNum CHAR(3), prereqMajor VARCHAR, prereqCourseNum CHAR(3), PRIMARY KEY (major, courseNum,prereqMajor,prereqCourseNum), FOREIGN KEY (major, courseNum) REFERENCES Course (major, courseNum), FOREIGN KEY (prereqMajor, prereqCourseNum) REFERENCES Course (major,courseNum) ); CREATE TABLE Class ( classID VARCHAR, major VARCHAR NOT NULL, courseNum CHAR (3) NOT NULL, semester VARCHAR(10), year CHAR(4), instructorID CHAR (8) NOT NULL, enrollmentlimit INTEGER, PRIMARY KEY (classID), FOREIGN KEY (major, courseNum) REFERENCES Course (major,courseNum), FOREIGN KEY (instructorID) REFERENCES Instructor(instructorID) CREATE TABLE Enroll ( studentID CHAR(8), classID VARCHAR, grade INTEGER, PRIMARY KEY (classID, studentID), FOREIGN KEY (classID) REFERENCES Class(classID), FOREIGN KEY (studentID REFERENCES Student (studentID) ); CREATE TABLE Assignment ( classID VARCHAR, assignmentNo INTEGER, title VARCHAR, weight INTEGER, deadline DATE, PRIMARY KEY (classID, assignmentNo), FOREIGN KEY (classID) REFERENCES Class(classID) ); CREATE TABLE Submit ( studentID CHAR (8), classID VARCHAR, assignmentNo INTEGER, score INTEGER, submissionDate DATE, PRIMARY KEY (studentID, classID, assignmentNo), FOREIGN KEY (classID, assignment No) REFERENCES Assignment(classID, assignmentNo), FOREIGN KEY (studentID) REFERENCES Student (studentID) ); CREATE TABLE Post ( postID INTEGER, userID CHAR (8) NOT NULL, kind VARCHAR, timestamp DATE, content VARCHAR, popularity INTEGER, PRIMARY KEY (postID), FOREIGN KEY (userID) REFERENCES UserTable(userID) ); CREATE TABLE PostAbout ( postID INTEGER, classID VARCHAR, assignmentNo INTEGER, PRIMARY KEY (postID,classID, assignmentNo), FOREIGN KEY (postID) REFERENCES Post(postID), FOREIGN KEY (classID, assignmentNo) REFERENCES Assignment(classID, assignmentNo) ); You will use the online RelaX relational algebra calculator tool to write the queries. To use the tool, simply go to the link: https://dbis-uibk.github.io/relax/calc/gist/dad302f1c596d5fd2d3dcad0b1d7c410 and type the relational algebra expressions in the textbox. A sample dataset for the above relations will be automatically loaded when you open the above link. In the tool, you can try the queries and check the output. The expected output for each relational algebra expression is also provided. (The Relax tool uses set semantics, so you don't need to remove duplicates) Important note: The sample outputs for the queries are provided to help you test your own solutions. If you include "hard-coded"conditions just to obtain the query output, you won't get any credit for your solution. In your submission: For each query, take a screenshot of the relational algebra expression, the tree, and the output and paste them in a MS Word file. Crop the unnecessary parts of the images to save space. An example is provided in Appendix-A. Make sure to include the parts marked with arrows. 9. Find the classes that are full and overenrolled (i.e., enrollment count is more than the enrollment limit of the class). Return classid, major, courseNum, semester, year, enrollmentlimit of the class and the number of students enrolled. Enroll.classID Class.major Class.courseNum Class.semester Class.year Class.enrollmentlimit num Students 2019501CptS451 Cpts 451 'Spring 2019 8 14 2019S01CptS437 Cpts 437 'Spring 2019 14 14 APPENDIX-A Example output a. Relational Algebra Expression: i firstName, lastName, classID, major, courseNum ((UserTable (userID = instructorID) (o title='Professor' Instructor)) Class) b. Relational algebra tree: I firstName, lastName, dassID, major, courseNum D (userID = instructorID) Class UserTable title="Professor Instructor C. Expression and Output: User Table.firstName User Table.lastName Class.classid Class.major Class.courseNum Diane Cook 2019501Cpts437 Cpts 437 Diane Cook 2020501Cpts437 Cpts 437

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

6. What data will she need?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago