I'm wondering how to start this assignment?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I'm wondering how to start this assignment?

Instructions

In SQL Server, create a new database called University.

Given the ERD in this document, write the CREATE TABLE statements to construct the tables for this database.  Be sure to use reasonable data types and create all tables, attributes, primary keys, foreign keys, and “not null” constraints in your statements where appropriate. 

To receive full credit for this assignment, your CREATE TABLE statements must be executed in SQL Server

In a new Word document, copy the ERD and type your CREATE TABLE statements below the ERD.  Then, in SQL Server, after you execute each CREATE TABLE statement, issue these two statements:

SELECT * FROM [table name]

exec sp_help [table name]. 

Note:  exec sp_help [table name] is a built-in stored procedure that you run to easily see your table structure, including fieldnames, data types, primary keys, foreign key constraints, etc.  It’s a very useful tool. 

Take a screen shot of your queries and their results and paste the screenshot below each CREATE TABLE statement.  Put each table on a separate page of your word document.

To illustrate, the Campuses table has been created for you on the page following the ERD and Narrative Description section.

 

Before you begin…a few helpful hints:

  1. Making mistakes (we all do)

Don’t forget that you can use the ALTER TABLE command to go back and add constraints or change fields if needed.  Many times, you may find it easier to simply delete the table and start over.  To delete an entire table, enter DROP TABLE [table name], and begin again.  You can also use the DROP command to delete your entire database.  To do this, however, you must be “in” a different database.  That is, you cannot drop a database that you are currenting “using”.  To drop a database, “USE” a different database other than the one you’re deleting and then enter DROP DATABASE [database name].

 

  1. Multiple fields as the primary key

Some of the entities in the ERD below (namely the weak entities) will require you to specify multiple fields as the primary key (i.e. a composite primary key). To do this, simply separate the fields with a comma in your primary key constraint.  For example, if you have a weak entity InvoiceItems, whose primary key consists of an InvoiceID from an Invoices entity and an InvoiceItemID from the InvoiceItems entity, your primary key constraint would appear as follows:

CONSTRAINT pk_InvoiceItems PRIMARY KEY (InvoiceID, InvoiceItemID) ß Note that two fields are listed

You will also need to specify where the InvoiceID comes from in your foreign key constraint:

CONSTRAINT fk_InvoiceItems_Invoices FOREIGN KEY (InvoiceID) REFERENCES Invoices

 

  1. Many-to-many relationships

Don’t forget that many-to-many relationships result in a “bridge” table that are not shown on the ERD but must be constructed in your database. 

 

 

 

 

 

CREATE TABLE Invoices(

DiagnosisCategoryID int,

DiagnosisItemID int

)

In this case, both DiagnosisCategoryID and DiagnosisItemID must be referenced in your foreign key constraint and point to the one DiagnosisItems table.  The constraint would appear like this:

CONSTRAINT fk_Invoices_DiagnosisItems FOREIGN KEY (DiagnosisCategoryID, DiagnosisItemID) REFERENCES DiagnosisItems

 

Now, finally, here is your assignment…

 

 

 

 

ERD for the University database

 

 

 

 

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Payback period
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education