0% found this document useful (0 votes)
53 views6 pages

Library Management System

The document contains the code to create 5 tables for a library management system database: Books, Members, Transactions, Librarians, and Suppliers. It includes code to insert data into each table and sample queries on each table.

Uploaded by

logeshinbam
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)
53 views6 pages

Library Management System

The document contains the code to create 5 tables for a library management system database: Books, Members, Transactions, Librarians, and Suppliers. It includes code to insert data into each table and sample queries on each table.

Uploaded by

logeshinbam
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/ 6

LIBRARY MANAGEMENT SYSTEM

ASSINGMENT-1
CS-19442 DATABASE MANAGEMENT SYSTEM
TABLE-1:

CREATE TABLE Books (


Title CHAR NOT NULL,
Author CHAR NOT NULL,
ISBN INT NOT NULL,
Genre CHAR NOT NULL,
NumberOfCopies INT NOT NULL
);

INSERT INTO Books (Title, Author, ISBN, Genre, NumberOfCopies)


VALUES
('The Great Gatsby', 'F. Scott Fitzgerald', '9780743273565',
'Fiction', 5),
('To Kill a Mockingbird', 'Harper Lee', '9780446310789', 'Fiction',
10),
('Pride and Prejudice', 'Jane Austen', '9780141439518', 'Fiction',
8),
('1984', 'George Orwell', '9780451524935', 'Dystopian Fiction', 12),
('The Lord of the Rings', 'J.R.R. Tolkien',
'9780544003415','Fantasy', 15);

OUTPUT:

select * from Books


where NumberOfCopies BETWEEN 8 and 15;
TABLE-2:

CREATE TABLE Members (


Name CHAR NOT NULL,
Address CHAR NOT NULL,
PhoneNumber CHAR NOT NULL,
Email CHAR NOT NULL,
LibraryCardNumber CHAR NOT NULL

);
INSERT INTO Members (Name, Address, PhoneNumber, Email,
LibraryCardNumber)
VALUES
('John Doe', '123 Main St', '5555551212', '[email protected]',
'2022-01-01'),
('Jane Doe', '456 Oak Ave', '5555551213', '[email protected]',
'2022-02-01'),
('Jim Smith', '789 Pine Blvd', '5555551214', '[email protected]',
'2022-03-01'),
('Bob Johnson', '111 Maple Rd', '5555551215',
'[email protected]', '2022-04-01'),
('Sally Green', '222 Cedar St', '5555551216',
'[email protected]', '2022-05-01');

OUTPUT:

select * from Members


where phoneNumber<=5555551213
TABLE-3:

CREATE TABLE Transactions (


BookFee INT(10,2) NOT NULL,
BookLoanDate DATE NOT NULL,
ReturnDate DATE NOT NULL,
LateFee INT(10,2) NOT NULL,
MemberID INT NOT NULL
);

INSERT INTO Transactions (BookFee, BookLoanDate, ReturnDate, LateFee,


MemberID)
VALUES
(2.00, '2022-01-01', '2022-01-07', 0.00, 1),
(2.00, '2022-02-01', '2022-02-07', 0.00, 2),
(2.00, '2022-03-01', '2022-03-07', 0.00, 3),
(2.00, '2022-04-01', '2022-04-08', 1.00, 4),
(2.00, '2022-05-01', '2022-05-07', 0.00, 5);

OUTPUT:

select * from Transactions


where MemberID IN (3,5);
TABLE-4:

CREATE TABLE Librarians (


Name CHAR NOT NULL,
Address CHAR NOT NULL,
PhoneNumber CHAR NOT NULL,
Email CHAR NOT NULL,
HiringDate DATE NOT NULL
);

INSERT INTO Librarians (Name, Address, PhoneNumber, Email, HiringDate)


VALUES
('Jane Doe', '123 Main St', '555-555-1212', '[email protected]',
'2021-01-01'),
('John Doe', '456 Elm St', '555-555-1213', '[email protected]',
'2021-02-01'),
('Jim Smith', '789 Oak St', '555-555-1214', '[email protected]',
'2021-03-01'),
('Jane Smith', '246 Pine St', '555-555-1215',
'[email protected]', '2021-04-01'),
('John Smith', '369 Cedar St', '555-555-1216',
'[email protected]', '2021-05-01');

OUTPUT:

select * from Librarians


where Name='Jane Doe'
TABLE-5:

CREATE TABLE Suppliers (


Name CHAR NOT NULL,
Address CHAR NOT NULL,
PhoneNumber CHAR NOT NULL,
Email CHAR NOT NULL,
BooksSupplied CHAR NOT NULL
);

INSERT INTO Suppliers (Name, Address, PhoneNumber, Email,


BooksSupplied)
VALUES
('Book Co.', '123 Main St', '555-555-1212', '[email protected]',
'History, Mystery, Romance'),
('Paperback Co.', '456 Elm St', '555-555-1213',
'[email protected]', 'Science Fiction, Fantasy, Horror'),
('Textbook Co.', '789 Oak St', '555-555-1214',
'[email protected]', 'Math, Science, Social Studies'),
('Childrens Book Co.', '246 Pine St', '555-555-1215',
'[email protected]', 'Picture Books, Early Readers'),
('Young Adult Book Co.', '369 Cedar St', '555-555-1216',
'[email protected]', 'Dystopian, Romance, Adventure');

OUTPUT:

select *from Suppliers


where PhoneNumber>='555-555-1214'

You might also like