Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Assignment 0 1 Example : University Database ImplementationBusiness Use Case:A university wants to develop a database system to manage its academic operations. The system
Lab Assignment Example : University Database ImplementationBusiness Use Case:A university wants to develop a database system to manage its academic operations. The system should keep track of students, professors, courses, departments, enrollments, and course assignments. The database will be used to store and retrieve information efficiently and ensure data integrity.Tasks:Identify Tables and Attributes:Based on the use case, identify at least five tables required for the university database.Define appropriate attributes for each table.Identify candidate keys and primary keys for each table.Create Tables:Write SQL scripts to create the identified tables with the defined attributes, including constraints for candidate keys, primary keys, and foreign keys.Insert Data:Insert sample data into each table to represent realistic university scenarios.Create Database Diagram:Generate a database diagram that includes all the tables and their relationships.Run SELECT Queries:Execute SELECT queries to retrieve and display the data from each table.Documentation:Include screenshots of the database diagram and the results of your SELECT queries in your submission.StepbyStep Instructions:Step : Identify Tables and AttributesTables and Attributes:DepartmentsDepartmentID INT Primary KeyDepartmentCode VARCHAR Candidate KeyDepartmentName VARCHARProfessorsProfessorID INT Primary KeySSN CHAR Candidate KeyEmail VARCHAR Candidate KeyFirstName VARCHARLastName VARCHARHireDate DATEDepartmentID INT Foreign KeyStudentsStudentID INT Primary KeySSN CHAR Candidate KeyEmail VARCHAR Candidate KeyFirstName VARCHARLastName VARCHARDateOfBirth DATECoursesCourseID INT Primary KeyCourseCode VARCHAR Candidate KeyCourseName VARCHARCredits INTDepartmentID INT Foreign KeyEnrollmentsEnrollmentID INT Primary KeyStudentID INT Foreign KeyCourseID INT Foreign KeyEnrollmentDate DATEGrade CHARUNIQUE StudentID CourseIDComposite Candidate KeyCourseAssignmentsAssignmentID INT Primary KeyCourseID INT Foreign KeyProfessorID INT Foreign KeyAssignmentDate DATEUNIQUE CourseID ProfessorIDComposite Candidate KeyStep : Create Tables Creating Departments TableCREATE TABLE Departments DepartmentID INT NOT NULL, Candidate Key DepartmentCode VARCHAR NOT NULL UNIQUE, Candidate Key DepartmentName VARCHAR NOT NULL, PRIMARY KEY DepartmentID Primary Key; Creating Professors TableCREATE TABLE Professors ProfessorID INT NOT NULL, Candidate Key SSN CHAR NOT NULL UNIQUE, Candidate Key Email VARCHAR NOT NULL UNIQUE, Candidate Key FirstName VARCHAR LastName VARCHAR HireDate DATE, DepartmentID INT, PRIMARY KEY ProfessorID Primary Key FOREIGN KEY DepartmentID REFERENCES DepartmentsDepartmentID; Creating Students TableCREATE TABLE Students StudentID INT NOT NULL, Candidate Key SSN CHAR NOT NULL UNIQUE, Candidate Key Email VARCHAR NOT NULL UNIQUE, Candidate Key FirstName VARCHAR LastName VARCHAR DateOfBirth DATE, PRIMARY KEY StudentID Primary Key; Creating Courses TableCREATE TABLE Courses CourseID INT NOT NULL, Candidate Key CourseCode VARCHAR NOT NULL UNIQUE, Candidate Key CourseName VARCHAR NOT NULL, Credits INT, DepartmentID INT, PRIMARY KEY CourseID Primary Key FOREIGN KEY DepartmentID REFERENCES DepartmentsDepartmentID; Creating Enrollments TableCREATE TABLE Enrollments EnrollmentID INT NOT NULL, Candidate Key StudentID INT NOT NULL, CourseID INT NOT NULL, EnrollmentDate DATE, Grade CHAR PRIMARY KEY EnrollmentID Primary Key UNIQUE StudentID CourseID Candidate Key Composite FOREIGN KEY StudentID REFERENCES StudentsStudentID FOREIGN KEY CourseID REFERENCES CoursesCourseID; Creating CourseAssignments TableCREATE TABLE CourseAssignments AssignmentID INT NOT NULL, Candidate Key CourseID INT NOT NULL, ProfessorID INT NOT NULL, AssignmentDate DATE, PRIMARY KEY AssignmentID Primary Key UNIQUE CourseID ProfessorID Candidate Key Composite FOREIGN KEY CourseID REFERENCES CoursesCourseID FOREIGN KEY ProfessorID REFERENCES ProfessorsProfessorID;Step : Insert DataSample Data: Inserting data into DepartmentsINSERT INTO Departments DepartmentID DepartmentCode, DepartmentNameVALUES CS 'Computer Science' 'MATH', 'Mathematics'PHYS 'Physics'; Inserting data into ProfessorsINSERT INTO Professors ProfessorID SSN Email, FirstName, LastName, HireDate, DepartmentIDVALUES 'jdoe@university.edu', 'John', 'Doe', 'asmith@university.edu', 'Alice', 'Smith', ; Inserting data into StudentsINSERT INTO Students StudentID SSN Email, FirstName, LastName, DateOfBirthVALUES 'bwilson@student.edu', 'Bob', 'Wilson', 'mjones@student.edu', 'Mary', 'Jones', ; Inserting data into CoursesINSERT INTO Courses CourseID CourseCode, CourseName, Credits, DepartmentIDVALUES CS 'Introduction to Computer Science', 'MATH 'Calculus I; Inserting data into EnrollmentsINSERT INTO Enrollments EnrollmentID StudentID, CourseID, EnrollmentDate, GradeVALUES AB; Inserting data into CourseAssignmentsINSERT INTO CourseAssignments AssignmentID CourseID, ProfessorID, AssignmentDateVALUES ;Step : Create Database DiagramGenerate a database diagram that shows all the tables and their relationships. Ensure that the diagram clearly illustrates primary keys, foreign keys, and the relationships between the tables.Step : Run SELECT QueriesQueries to Verify Data: Select data from DepartmentsSELECT FROM Departments; Select data from ProfessorsSELECT FROM Professors; Select data from StudentsSELECT FROM Students; Select data from CoursesSELECT FROM Courses; Select data from EnrollmentsSELECT FROM Enrollments; Select data from CourseAssignmentsSELECT FROM CourseAssignments;
Step 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