Relational Database Design: Entity Relationship Model and SQL Code for Table Creation, Essays (university) of Marketing

An Entity Relationship Model for a library database design, including the definition of entities such as Library_Branch, Books, Staff, Authors, and Members. It also includes SQL code for creating the corresponding tables in the database. The entities are defined with their respective attributes and constraints, such as primary keys and foreign keys.

Typology: Essays (university)

2020/2021

Uploaded on 02/06/2021

f17bb033-m-ahmad-abduhu
f17bb033-m-ahmad-abduhu 🇵🇰

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Relational Model
pf3
pf4
pf5

Partial preview of the text

Download Relational Database Design: Entity Relationship Model and SQL Code for Table Creation and more Essays (university) Marketing in PDF only on Docsity!

Relational Model

Entity Relationship Model

BID VarChar(5), BName VarChar(20)NOT NULL, NO_OF_Copies integer, LBID VarChar(5), Constraint pk_BkID PRIMARY KEY (BID), Constraint fk_LBID FOREIGN KEY (LBID) REFERENCES LIBRARY_BRANCH (LBID) )

3) CREATE TABLE Members(

MID varchar(5), MName varchar(20) NOT NULL, Gender varchar(6) NOT NULL, Address varchar(30) NOT NULL, CellNO Varchar(11) NOT NULL, Constraint pk_MID primary key (MID) )

4) Create Table AUTHORS(

AID VarChar(5), AName VarChar(20) NOT NULL, CELLNO VarChar(11) NOT NULL, Constraint pk_AID PRIMARY KEY (AID) )

5) Create Table Staff(

SID Varchar(5), SName Varchar(20) NOT NULL, Gender Varchar(6) NOT NULL, Designation Varchar(25) NOT NULL, Salary integer, Address varchar(30), CellNO varchar(11) NOT NULL, LBID Varchar(2), Constraint pk_SID primary key (SID), Constraint fk_libID foreign key (LBID) REFERENCES library_branch(LBID) )

6) CREATE TABLE Book_Author(

BID Varchar(5), AID varchar(5), Constraint fk_BkID foreign key (BID) REFERENCES BOOKS (BID), Constraint fk_AuID foreign key (AID) REFERENCES AUTHORS (AID) )

7) CREATE TABLE Book_Ledger(

MID varchar(5), BID varchar(5),