Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the relations that you defined and normalized as part of the unit 4 assign

ID: 3858488 • Letter: U

Question

Using the relations that you defined and normalized as part of the unit 4 assignment, create the SQL DML statements necessary to implement your database schema as an OpenOffice database. You may also implement your database in MySQL, IBM DB2 Express, or Microsoft Access if you have access to these database systems. Your assignment must include a document that contains all of the SQL statements that you created and a screen shot that shows the structures that you implemented in the database of your choice. Your DML statements must accommodate the following elements:

Create statements to create tables from the entities defined as part of the Unit 4 assignment

Appropriate use of Null (and Not Null) parameters to ensure data validity

Appropriate use of constraint clauses to implement appropriate referential integrity

Use of data types and formats that is appropriate for the data in your database schema.

Appropriate use of keys including automatic generation of key values if appropriate

Assignment Instructions:

the assignment must include the SQL DML statements required to implement at least the following relations:

Book

Borrower

BookLended

Librarian

the assignment must make appropriate use of Null (and Not Null) parameters to ensure data validity. The minimum standard will be measured against the instructor’s example and will be based upon rules associated with primary and foreign keys and integrity constraint rules.

the assignment must make appropriate use of constraint clauses to ensure the referential integrity of the relations in the schema. The minimum standard will be measured against the instructor’s example and will be based upon rules associated with primary and foreign keys and integrity constraint rules. NOTE: the unary relationship that we defined for the librarian relation is NOT required as part of this assignment.

the assignment must make appropriate use of keys including the automatic generation of key values where appropriate.

Explanation / Answer

If you have any doubts, please give me comment...

CREATE TABLE Book(

ISBN_Number INTEGER NOT NULL PRIMARY KEY,

Title VARCHAR(50),

Author VARCHAR(50),

Publication_date DATE,

cost REAL(10,2)

);

CREATE TABLE Librarian(

LibrarianID INTEGER NOT NULL PRIMARY KEY,

Name VARCHAR(100),

PhoneNumber INTEGER,

Supervisor INTEGER,

FOREIGN KEY(Supervisor) REFERENCES Librarian(LibrarianID)

);

CREATE TABLE Borrower(

LibraryCard INTEGER NOT NULL PRIMARY KEY,

Name VARCHAR(100),

Address VARCHAR(100),

PostalCode CHAR(5),

PhoneNumber CHAR(15),

Membershipdate DATE

);

CREATE TABLE BookLended(

Librarycard INTEGER,

librarianID INTEGER,

ISBN_Number INTEGER,

CheckOutDate DATE,

PRIMARY KEY(Librarycard, librarianID, ISBN_Number),

FOREIGN KEY(librarianID) REFERENCES Librarian(librarianID),

FOREIGN KEY(ISBN_Number) REFERENCES Book(ISBN_Number),

FOREIGN KEY(Librarycard) REFERENCES Borrower(LibraryCard)

);