0% found this document useful (0 votes)
4 views

week_5_physical_design

The document outlines the physical design of a data management project, including the creation of several tables such as Users, Books, UsersBooks, Borrowings, Publishers, Genres, and Authors. It provides SQL statements for creating these tables with their respective fields and relationships. Additionally, it includes INSERT statements to populate the Books table with a selection of literary titles and their ISBNs.

Uploaded by

Charan Ellendula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

week_5_physical_design

The document outlines the physical design of a data management project, including the creation of several tables such as Users, Books, UsersBooks, Borrowings, Publishers, Genres, and Authors. It provides SQL statements for creating these tables with their respective fields and relationships. Additionally, it includes INSERT statements to populate the Books table with a selection of literary titles and their ISBNs.

Uploaded by

Charan Ellendula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1

Week 5 – Data Management Project: Physical Design

Vamshi Krishna Gali

Wilmington University

IST 7000: Data Management

David, Sten

December 02, 2023


2

1. CREATE TABLE

CREATE TABLE Users (

UserID INT PRIMARY KEY,

Name VARCHAR(255) NOT NULL,

EmailAddress VARCHAR(255) NOT NULL,

PhoneNumber VARCHAR(20)

);

CREATE TABLE Books (

BookID INT PRIMARY KEY,

Title VARCHAR(255) NOT NULL,

ISBN VARCHAR(13) NOT NULL

);

CREATE TABLE UsersBooks (

UserBookID INT PRIMARY KEY,

UserID INT,

BookID INT,
3

FOREIGN KEY (UserID) REFERENCES Users(UserID),

FOREIGN KEY (BookID) REFERENCES Books(BookID)

);

CREATE TABLE Borrowings (

BorrowingID INT PRIMARY KEY,

UserID INT,

BookID INT,

DateBorrowed DATE,

DateReturned DATE,

FOREIGN KEY (UserID) REFERENCES Users(UserID),

FOREIGN KEY (BookID) REFERENCES Books(BookID)

);

CREATE TABLE Publishers (

PublisherID INT PRIMARY KEY,

Name VARCHAR(255) NOT NULL

);
4

CREATE TABLE Genres (

GenreID INT PRIMARY KEY,

GenreName VARCHAR(255) NOT NULL

);

CREATE TABLE Authors (

AuthorID INT PRIMARY KEY,

FirstName VARCHAR(255) NOT NULL,

LastName VARCHAR(255) NOT NULL,

Biography TEXT

);

2. write INSERT statements

INSERT INTO Books (BookID, Title, ISBN)

VALUES

(1, 'The Great Gatsby', '9781597226769'),

(2, 'Pride and Prejudice', '9780141439518'),

(3, '1984', '9780451524935'),


5

(4, 'The Catcher in the Rye', '9780316769174'),

(5, 'To Kill a Mockingbird', '9780060935467'),

(6, 'Lord of the Flies', '9780399501487'),

(7, 'The Hobbit', '9780547928227'),

(8, 'The Lion, the Witch and the Wardrobe', '9780064409421'),

(9, 'The Alchemist', '9780062315007'),

(10, 'The Kite Runner', '9781594631931');

You might also like