Question

In: Accounting

Phase 1 – ERD In this phase of the project you will create an ERD based...

Phase 1 – ERD

In this phase of the project you will create an ERD based upon the following requirements and business rules. Limit your ERD to entities and relationships based on the business rules showed here. In other words, do not add realismto your design by expanding or refining the business rules.  However, make sure you include all attributes needed that would permit the model to be successfully implemented, including all primary and foreign keys.

1.Trinity College (TC) is divided into several schools: a school of business, a school of arts and sciences, a school of education, and a school of applied sciences. Each school is administered by a dean who is a professor.  Each dean can administer only one school.  Each school must have a school name.

2.Each school is composed of several departments.  The smallest number of departments operated by a school is one, and the largest number of departments is indeterminate.  Each department belongs to only one school. A department may be classified as research only.  Each department must have a department name.

3.Each department may have many professors assigned to it.  One of those professors chairs the department.  Only one professor may chair the department to which he or she is assigned.  No professor is required to accept the chair position.  Each professor must have a first name, last name, rank, specialty, and an email.

4.Each department may offer courses.  Each course is offered by only one department.  If a department is research only, it will offer no courses. Each course must have a course title, description, and number of credits.

5.A class will be a section of a course.   A course may exist in Trinity College’s catalog even when it is not offered as a class in a current schedule.  Each class must have a class section and class time.

6.Each professor can teach up to four classes.  A professor may also be on a research contract and teach no classes at all.

7.A student may enroll in up to six classes, but takes each class only once during each enrollment period. Each class may have up to 35 students.  A class can exist even though no students are enrolled in it.

8.Each department has several students whose major is offered by that department, but a student can have only one major and is, therefore, associated with only one department. A student is not required to declare a major field of study when first enrolling.

9.Each student has an advisor in his or her department, each advisor counsels several students.  An advisor is a professor, but not all professors advise students.

10.Each class is taught in a room, and each room is located in a building.  A building can contain many rooms, but a room can only be contained in one building. Some buildings do not contain class rooms (e.g., maintenance building).  A room must have a room type, a building must have a building name and location.

Phase 2. After reviewing the various ERDs, Trinity College has decided on the following tables and attributes.

PROFESSOR

Professor ID

Department

Professor Specialty

Professor Rank

Professor Last Name

Professor First Name

Professor Initial

Professor Email

SCHOOL

School ID

School Name

SCHOOLDEAN

School

Dean

DEPARTMENT

Department Code

Department Name

School

DEPARTMENTCHAIR

Department

Chair

STUDENT

Student ID

Department

Student Last Name

Student First Name

Student Initial

Student Email

Advisor

COURSE

Course Code

Department

Course Title

Course Description

Course Credits

CLASS

Class Code

Class Section

Class Time

Course

Professor

Room

ENROLL

Class

Student

Enrollment Date

Enrollment Grade

BUILDIING

Building Name

Building Location

ROOM

Room Code

Room Type

Building

Write the SQL code to drop and then create the above tables.  Remember that when creating tables, the tables with foreign keys have to be created afterthe table that the foreign key points to.  When dropping tables, they have to be dropped in the reverse order, so that the tables with foreign keys are dropped beforethe tables that the foreign keys point to.  You can create all the drop SQL statements first followed by all the create tables.  The first time you run them the drop statements will work as no tables have been created and therefore no drops will occur.  You will need to run them twice to insure the drops will work.

Please be sure to review the Phase 1 requirements so you can determine the primary and foreign keys for each table and then determine the order of DROP and CREATE STATEMENTS. Please note that some fields are foreign keys but not identified as such by their names. Also know which fields are required fields and which are not.  Use appropriate data types for each field and meaningful field names.  

Solutions

Expert Solution

Phase 1:

Phase 2:

Queries:

-- Drop commands

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ENROLL]') AND type in (N'U'))

DROP TABLE [dbo].[ENROLL]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CLASS]') AND type in (N'U'))

DROP TABLE [dbo].[CLASS]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROOM]') AND type in (N'U'))

DROP TABLE [dbo].[ROOM]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BUILDING]') AND type in (N'U'))

DROP TABLE [dbo].BUILDING

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DEPARTMENTCHAIR]') AND type in (N'U'))

DROP TABLE [dbo].[DEPARTMENTCHAIR]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SCHOOLDEAN]') AND type in (N'U'))

DROP TABLE [dbo].[SCHOOLDEAN]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[COURSE]') AND type in (N'U'))

DROP TABLE [dbo].[COURSE]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PROFESSOR]') AND type in (N'U'))

DROP TABLE [dbo].[PROFESSOR]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[STUDENT]') AND type in (N'U'))

DROP TABLE [dbo].[STUDENT]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DEPARTMENT]') AND type in (N'U'))

DROP TABLE [dbo].[DEPARTMENT]

GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SCHOOL]') AND type in (N'U'))

DROP TABLE [dbo].[SCHOOL]

GO

-- Create table commands

CREATE TABLE PROFESSOR(

ProfessorID INT IDENTITY PRIMARY KEY, -- You can make it a normal column instead of identity as well

Department INT,

ProfessorSpecialty VARCHAR(500),

ProfessorRank TINYINT,

ProfessorLastName VARCHAR(500),

ProfessorFirstName VARCHAR(500),

ProfessorInitial VARCHAR(10), -- Initials cannot be more than

ProfessorEmail VARCHAR(100)

)

CREATE TABLE SCHOOL(

SchoolID INT IDENTITY PRIMARY KEY, -- You can make it a normal column instead of identity as well

SchoolName VARCHAR(500)

)

CREATE TABLE SCHOOLDEAN (

School INT PRIMARY KEY,

Dean VARCHAR(500)

)

CREATE TABLE DEPARTMENT(

DepartmentCode INT IDENTITY PRIMARY KEY, -- You can make it a normal column instead of identity as well

DepartmentName VARCHAR(500),

School INT

)

CREATE TABLE DEPARTMENTCHAIR(

Department INT PRIMARY KEY,

Chair VARCHAR(500)

)

CREATE TABLE STUDENT(

[Student ID] INT IDENTITY PRIMARY KEY

,[Department] INT

,[Student Last Name] VARCHAR(500)

,[Student First Name] VARCHAR(500)

,[Student Initial] VARCHAR(10)

,[Student Email] VARCHAR(100)

,[Advisor] VARCHAR(100)

)

CREATE TABLE COURSE(

CourseCode INT IDENTITY PRIMARY KEY

,Department INT

,CourseTitle VARCHAR(100)

,CourseDescription VARCHAR(500)

,CourseCredits FLOAT

)

CREATE TABLE CLASS (

[Class Code] INT IDENTITY PRIMARY KEY

,[Class Section] VARCHAR(10)

,[Class Time] DATETIME

,[Course] INT

,[Professor] INT

,[Room] INT

)

CREATE TABLE ENROLL (

[Class] INT

,[Student] INT

,[Enrollment Date] DATETIME

,[Enrollment Grade] FLOAT

)

CREATE TABLE BUILDING (

[Building Name] VARCHAR(250) PRIMARY KEY

,[Building Location] VARCHAR(500)

)

CREATE TABLE ROOM (

[Room Code] INT IDENTITY PRIMARY KEY

,[Room Type] VARCHAR(100)

,[Building] VARCHAR(250)

)

GO

-- Add foreign keys

ALTER TABLE PROFESSOR

ADD CONSTRAINT FK_PROFESSOR_Department FOREIGN KEY (Department)

REFERENCES Department (DepartmentCode)

ALTER TABLE DEPARTMENTCHAIR

ADD CONSTRAINT FK_DEPARTMENTCHAIR_Department FOREIGN KEY (Department)

REFERENCES Department (DepartmentCode)

ALTER TABLE STUDENT

ADD CONSTRAINT FK_STUDENT_Department FOREIGN KEY (Department)

REFERENCES Department (DepartmentCode)

ALTER TABLE COURSE

ADD CONSTRAINT FK_COURSE_Department FOREIGN KEY (Department)

REFERENCES Department (DepartmentCode)

ALTER TABLE SCHOOLDEAN

ADD CONSTRAINT FK_SCHOOLDEAN_School FOREIGN KEY (School)

REFERENCES School (SchoolID)

ALTER TABLE Department

ADD CONSTRAINT FK_School_Department FOREIGN KEY (School)

REFERENCES School (SchoolID)

ALTER TABLE CLASS

ADD CONSTRAINT FK_CLASS_Course FOREIGN KEY ([Course])

REFERENCES Course (CourseCode)

ALTER TABLE CLASS

ADD CONSTRAINT FK_CLASS_Room FOREIGN KEY ([Room])

REFERENCES ROOM ([Room Code])

ALTER TABLE CLASS

ADD CONSTRAINT FK_CLASS_Professor FOREIGN KEY ([Professor])

REFERENCES [Professor] (ProfessorID)

ALTER TABLE ENROLL

ADD CONSTRAINT FK_CLASS_ENROLL FOREIGN KEY (Class)

REFERENCES Class ([Class Code])

ALTER TABLE ENROLL

ADD CONSTRAINT FK_ENROLL_Student FOREIGN KEY (Student)

REFERENCES Student ([Student ID])

ALTER TABLE Room

ADD CONSTRAINT FK_Room_Building FOREIGN KEY ([Building])

REFERENCES Building ([Building Name])


Related Solutions

1. Create an ERD that has at least 5 tables in it and include all of...
1. Create an ERD that has at least 5 tables in it and include all of the details and the correct notation (Min/Max cardinality and relationship name.) 2. Write a paragraph that explains the ERD. 3. Write the SQL Create, Insert, and Update statement to insert one of the entities from this ERD into a database.
Based on concepts related to a project life cycle, initiation phase, planning phase, the constraints and...
Based on concepts related to a project life cycle, initiation phase, planning phase, the constraints and challenges of executing projects and controlling projects. Reflect on the aspects of project management you feel can be applied to the project manager?
You must create an ERD diagram for medical office wait times for patients with the following...
You must create an ERD diagram for medical office wait times for patients with the following minimum requirements. Your ERD diagram must include your Business Rules with a min. of 10 rules At least 5 entities. These may be real (e.g. a person, vehicle, etc.) or abstract concepts (e.g. course, enrollment, categories, etc.) • There must be logical relationships between the entities. • Aim for all entities to have a minimum of seven attributes, but no fewer than 3 entities...
Create a PLSQL block that retrieves and displays information for a specific project based on project...
Create a PLSQL block that retrieves and displays information for a specific project based on project ID. Display the following on a single row of output: project ID, project name, number of pledges made, total dollars pledged, and the average pledge amount
Database: Question 11 Using the ERD from problem 10, create the relational schema.(Create an appropriate collection...
Database: Question 11 Using the ERD from problem 10, create the relational schema.(Create an appropriate collection of attributes for each of the entities. Make sure you use the appropriate naming conventions to name the attributes.)
Lesson 7: Course Project - Phase 2 This week you will begin working on Phase 2...
Lesson 7: Course Project - Phase 2 This week you will begin working on Phase 2 of your course project. Use the same scenario and data set from Phase 1. Create a new submission for this assignment (do not include the work you did for Phase 1 in your assignment submission). Your paper should have the following sections: 1. Point vs. Interval Estimation Here you will discuss the importance of constructing confidence intervals for the population mean. You want to...
Create a project schedule based on task dependencies and resource constraints
Create a project schedule based on task dependencies and resource constraints
Create an ERD (using Crow’s Foot Notation) for the following description. Be sure to include all...
Create an ERD (using Crow’s Foot Notation) for the following description. Be sure to include all necessary entities, attributes, and correct cardinality in relationships between entities. You have been asked to build a database for a sportswear company called AthFleet. The company owner needs to keep track of the customers that buy their products, the employees that work at AthFleet, the vendors that provide them with products, and the products themselves. Each vendor has contact with one employee representative and...
Create an ERD chart that prevents data redundancies and anomalies. The entire primary key must determine...
Create an ERD chart that prevents data redundancies and anomalies. The entire primary key must determine the values in the other columns of a table. No non-key column should determine the value of another column. The data this system must store: Property lot numbers and their corresponding addresses Owners’ last names and first names Owners’ various phone numbers Owners various email addresses Owner various mailing addresses and the months when they reside at them The relationship between owners and properties...
Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate....
Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate. Two-Bit Drilling Company keeps information on employees and their insurance dependents. Each employee has an employee number, name, date of hire, and title. If an employee is an inspector, then the date of certification and the renewal date for that certification should also be recorded in the system. For all employees, the Social Security number and dependent names should be kept. All dependents must...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT