DBMS (Dated: 17Jul2019)
ER Diagram for Library Database
----------------------------------------------------------------------------------------------
CREATE TABLE authors2( authorId int NOT NULL,name varchar(50) NULL,
surname varchar(70) NULL,
CONSTRAINT PK_authors PRIMARY KEY (authorId) );
----------------------------------------------------------------------------------------------
CREATE TABLE books( bookId int NOT NULL, name varchar(90) NULL,
pagecount int NULL, sem int NULL, authorId int NULL,
typeId int NULL, CONSTRAINT PK_books PRIMARY KEY (bookId) );
----------------------------------------------------------------------------------------------
CREATE TABLE borrows( borrowId int NOT NULL, studentId int NULL,
bookId int NULL, takenDate date NULL, broughtDate date NULL,
CONSTRAINT PK_borrows PRIMARY KEY (borrowId) );
----------------------------------------------------------------------------------------------
CREATE TABLE students( studentId int NOT NULL, name varchar(20) NULL,
surname varchar(20) NULL, birthdate date NULL,
gender varchar(10) NULL, class varchar(7) NULL,
sem int NULL, PRIMARY KEY (studentId) );
----------------------------------------------------------------------------------------------
CREATE TABLE types( typeId int NOT NULL,
name varchar(30) NULL,PRIMARY KEY (typeId) );
----------------------------------------------------------------------------------------------
INSERT into authors2 VALUES (1, 'William Dean', 'Howells');
----------------------------------------------------------------------------------------------
INSERT into books VALUES (1, 'Database Management Systems', 199, 684,
3, 9);
----------------------------------------------------------------------------------------------
INSERT into borrows VALUES (1, 360, 142, To_Date('01-07-2019','dd-mm-
yyyy'), To_Date('21-07-2019','dd-mm-yyyy'));
----------------------------------------------------------------------------------------------
INSERT into types VALUES (15, 'Engineering');
----------------------------------------------------------------------------------------------
INSERT into students VALUES (505, 'Collins', 'Bailey', To_Date('01-07-
2019','dd-mm-yyyy'), 'M', '11E', 966);
----------------------------------------------------------------------------------------------

Er diagram for library database

  • 1.
    DBMS (Dated: 17Jul2019) ERDiagram for Library Database ---------------------------------------------------------------------------------------------- CREATE TABLE authors2( authorId int NOT NULL,name varchar(50) NULL, surname varchar(70) NULL, CONSTRAINT PK_authors PRIMARY KEY (authorId) ); ---------------------------------------------------------------------------------------------- CREATE TABLE books( bookId int NOT NULL, name varchar(90) NULL, pagecount int NULL, sem int NULL, authorId int NULL, typeId int NULL, CONSTRAINT PK_books PRIMARY KEY (bookId) ); ---------------------------------------------------------------------------------------------- CREATE TABLE borrows( borrowId int NOT NULL, studentId int NULL, bookId int NULL, takenDate date NULL, broughtDate date NULL, CONSTRAINT PK_borrows PRIMARY KEY (borrowId) ); ----------------------------------------------------------------------------------------------
  • 2.
    CREATE TABLE students(studentId int NOT NULL, name varchar(20) NULL, surname varchar(20) NULL, birthdate date NULL, gender varchar(10) NULL, class varchar(7) NULL, sem int NULL, PRIMARY KEY (studentId) ); ---------------------------------------------------------------------------------------------- CREATE TABLE types( typeId int NOT NULL, name varchar(30) NULL,PRIMARY KEY (typeId) ); ---------------------------------------------------------------------------------------------- INSERT into authors2 VALUES (1, 'William Dean', 'Howells'); ---------------------------------------------------------------------------------------------- INSERT into books VALUES (1, 'Database Management Systems', 199, 684, 3, 9); ---------------------------------------------------------------------------------------------- INSERT into borrows VALUES (1, 360, 142, To_Date('01-07-2019','dd-mm- yyyy'), To_Date('21-07-2019','dd-mm-yyyy')); ---------------------------------------------------------------------------------------------- INSERT into types VALUES (15, 'Engineering'); ---------------------------------------------------------------------------------------------- INSERT into students VALUES (505, 'Collins', 'Bailey', To_Date('01-07- 2019','dd-mm-yyyy'), 'M', '11E', 966); ----------------------------------------------------------------------------------------------