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

Create an ERD based on the following business rules and requirements. Make sure that the ERD...
Create an ERD based on the following business rules and requirements. Make sure that the ERD follows good database design practices covered in Chapter 6. use an online visual paradigm tool to create the ERD NOST offers many different tours. For each tour, the tour name, approximate length (in hours), and fee charged is needed. Tours are classified into five categories: family friendly, adventure, hiking, camping, and water activities. Guides are identified by an employee ID, but the system should...
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 Crow’s Foot notation ERD to support the following business operations: Create a Crowsfoot notation...
Create a Crow’s Foot notation ERD to support the following business operations: Create a Crowsfoot notation ERD to support the following business operations: - A friend of yours has opened Marshfield Electronics and Repairs (MER) to repair smartphones, laptops, tablets, and MP3 players. She wants you to create a database to help her run her business. When a customer brings a device to MER for repair, data must be recorded about the customer, the device, and the repair (also referred...
In this project you will create a basic console based calculator program. The calculator can operate...
In this project you will create a basic console based calculator program. The calculator can operate in two modes: Standard and Scientific modes. The Standard mode will allow the user to perform the following operations: (+, -, *, /) add, subtract, multiply, and divide The Scientific mode will allow the user to perform the same functionality as the Standard add, subtract, multiply, and divide (+, -, *, / ) plus the following: sin x, cos x, tan x. (sin x,...
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
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...
This is for a hotel project. The first phase is a restaurant and the 2nd phase...
This is for a hotel project. The first phase is a restaurant and the 2nd phase is the hotel. It will be located on a small island in the Caribbean in the United States Virgin Islands. Vision statement Mission statement Product line or services provided Philosophy of the business The business and its environment General environment characteristics Industry environment and competition Location description Distinctive competencies
Create a project schedule based on task dependencies and resource constraints
Create a project schedule based on task dependencies and resource constraints
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT