Question
Task 1. Create a database using PostgreSQL Consider a small university database with the following data. Students: student_id (PK) name (Not Null) date_of_birth address email
Task 1. Create a database using PostgreSQL Consider a small university database with the following data. Students: student_id (PK) name (Not Null) date_of_birth address email (Unique) level (Not Null) 1 Alice Wood 06/15/1993 5637 NW 41 ST awood001@cis.fiu.edu ugrad 2 Henrie Cage 04/24/1994 1443 NW 7 ST hcage001@cis.fiu.edu ugrad 3 John Smith 01/09/1995 731 NW 87 AVE jsmit005@cis.fiu.edu ugrad 4 Franklin Wong 12/08/1995 638 NW 104 AV fwong001@cis.fiu.edu ugrad 5 Jennifer King 11/08/1998 3500 W Flagler ST jking001@cis.fiu.edu ugrad 6 Richard Young 12/05/1995 778 SW 87 AVE ryoun001@cis.fiu.edu grad 7 Robert Poore 08/22/1996 101 SW 8 ST rpoor001@cis.fiu.edu grad 8 Joyce English 07/31/1999 8421 SW 109 AV jengl001@cis.fiu.edu grad Faculties: faculty_id (PK) name (Not Null) date_of_birth address email (Unique) level (Not Null) 1 George Blunt 08/13/1979 11345 SW 56 ST bluns@cis.fiu.edu Instructor 2 Thomas Taylor 05/24/1988 4467 NW 8 ST taylt@cis.fiu.edu Instructor 3 Daniel Evans 10/07/1979 8754 SW 134 TER evand@cis.fiu.edu Professor 4 Ramesh Nara 09/15/1982 5631 SW 72 ST narar@cis.fiu.edu Professor 5 Steven Garden 09/18/1975 1277 SW 87 AVE gards@cis.fiu.edu Associate Professor 6 William Parre 11/22/1976 1570 NE 127 AVE parrw@cis.fiu.edu Associate Professor Courses: course_id (PK) description (Not Null) level (Not Null) instructor (FK) 1 Fundamentals of Computer Sys. ugrad 1 2 Software Engineering I ugrad 2 3 Computer Programming I ugrad 2 4 Introduction to Algorithms grad 4 5 Operating Systems grad 5 6 Software Design grad 6 7 Advanced Database grad 5 Enroll: student_id (FK/PK) course_id (FK/PK) grade 1 1 A 1 2 B 1 3 A 3 1 F 3 3 C 4 3 NA 5 1 B 6 6 C 6 7 B 7 7 B Requirements: Query1. Create the above-mentioned four tables with proper constraints and make sure both primary keys and foreign keys are specified. Note: (1) If the constraints might be modified in the future, then you should set it as table constraints while creating the tables (2) You will need to set up the foreign keys by using column constraints if the referred column is not a primary key. Query2. Insert the data for each table. Task 2. Manage a database using PostgreSQL Query1. Insert four more records to the table Enroll by using one query. student_id (FK/PK) course_id (FK/PK) grade 2 1 D 2 2 NA 2 3 F 8 5 A 8 7 A Query2. Delete the records from the table Enroll where grade is NA. Query3. Add one column called semester to the table Courses. Query4. Update the Enroll table and set the grade to C for Henrie Cage in class Computer Programming I. Query5. Add ON DELETE RESTRICT references constraint to instructor column in the Courses table. Query6. Add NOT NULL constraint to grade column in the Enroll table. Query7. Export the Enroll table as Enroll.csv by using SQL command COPY. (You need to be a root user to actually perform this action, so just provide the syntax of this query.)
Consider a small university database with the following data. Students: student idname (PK) date of_birth address email Ne (Unique) (Not Null) Alice Wood 06/15/1993 5637 NW 41 ST awood001@cis.fiu.edu ugrad Henrie Cage 04/24/1994 1443 NW 7 STe001@cis.fiu.edu ugrad John Smith 01/09/1995 731 NW 87 AVE jsmit005@cis.fiu.edu ugrad Franklin Wong 12/08/1995 638 NW 104 AVfwong001@cis.fiu.edu ugrad Jennifer King 11/08/1998 3500 W Flagler ST jking001@cis.fiu.edu ugrad Richard Young 12/05/1995 778 SW 87 AVE youn001@cis.fiu.edu grad (Not Null) 4 Robert Poore 08/22/1996101 SW 8 ST rpoor001@cis.fiu.edu grad Joyce English 07/31/1999 8421 SW 109 AV jengl001@cis.fiu.edu gradStep 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