You are on page 1of 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', 'johndoe@email.com',
'2022-01-01'),
('Jane Doe', '456 Oak Ave', '5555551213', 'janedoe@email.com',
'2022-02-01'),
('Jim Smith', '789 Pine Blvd', '5555551214', 'jimsmith@email.com',
'2022-03-01'),
('Bob Johnson', '111 Maple Rd', '5555551215',
'bobjohnson@email.com', '2022-04-01'),
('Sally Green', '222 Cedar St', '5555551216',
'sallygreen@email.com', '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', 'jane.doe@library.com',
'2021-01-01'),
('John Doe', '456 Elm St', '555-555-1213', 'john.doe@library.com',
'2021-02-01'),
('Jim Smith', '789 Oak St', '555-555-1214', 'jim.smith@library.com',
'2021-03-01'),
('Jane Smith', '246 Pine St', '555-555-1215',
'jane.smith@library.com', '2021-04-01'),
('John Smith', '369 Cedar St', '555-555-1216',
'john.smith@library.com', '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', 'bookco@library.com',
'History, Mystery, Romance'),
('Paperback Co.', '456 Elm St', '555-555-1213',
'paperbackco@library.com', 'Science Fiction, Fantasy, Horror'),
('Textbook Co.', '789 Oak St', '555-555-1214',
'textbookco@library.com', 'Math, Science, Social Studies'),
('Childrens Book Co.', '246 Pine St', '555-555-1215',
'childrensbookco@library.com', 'Picture Books, Early Readers'),
('Young Adult Book Co.', '369 Cedar St', '555-555-1216',
'youngadultbookco@library.com', 'Dystopian, Romance, Adventure');

OUTPUT:

select *from Suppliers


where PhoneNumber>='555-555-1214'

You might also like