Friday, December 13, 2019

Database for Library Management System

 Database for Library Management System

Software Used: SQL Server Management Studio R2

Steps:-

1. The SQL CREATE TABLE Statement-
The CREATE TABLE statement is used to create a new table in a database.
Syntax
CREATE TABLE table_name (column1 datatype, column2 datatype, ...)
2. The SQL CREATE DATABASE Statement-
The CREATE DATABASE statement is used to create a new SQL database.
Syntax
CREATE DATABASE databasename
3. The SQL SELECT Statement
The SELECT statement is used to select data from a database.
Syntax
SELECT * FROM table_name 
4. The SQL INSERT INTO Statement
The INSERT INTO statement is used to insert new records in a table.
Syntax
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...); 


Program:-

create database krishna
create table Book_Detail31(Book_ID int,Book_name varchar(50),Author varchar(50),No_Of_copies_Available int )
insert into
Book_Detail31(Book_ID,Book_name,Author,No_Of_copies_Available)
values(111,'CCN','J.S.Katre',5)
insert into
Book_Detail31(Book_ID,Book_name,Author,No_Of_copies_Available)
values(121,'MA','John Borrow',3)
insert into
Book_Detail31(Book_ID,Book_name,Author,No_Of_copies_Available)
values(152,'IPMV','Keiron Rodge',2)
insert into
Book_Detail31(Book_ID,Book_name,Author,No_Of_copies_Available)
values(135,'ARWP','Lorein Peter',1)
create table Student_Detail(Branch varchar(50),Member_ID int, Member_Name varchar(50),Issued_Book_ID int, No_of_Books_issued int)
insert into
Student_Detail(Branch,Member_ID,Member_Name,Issued_Book_ID,No_of_Books_issued)
values('EXTC',212,'Krishna',111,1)
insert into
Student_Detail(Branch,Member_ID,Member_Name,Issued_Book_ID,No_of_Books_issued)
values('Computer',211,'Karan',121,2)
insert into
Student_Detail(Branch,Member_ID,Member_Name,Issued_Book_ID,No_of_Books_issued)
values('Mechanical',213,'Sumit',135,3)
insert into
Student_Detail(Branch,Member_ID,Member_Name,Issued_Book_ID,No_of_Books_issued)
values('Electrical',214,'Chetan',152,1)
create table Library_Detail(Member_ID int,Book_ID int,Issue_Date date,Return_Date date,Total_Fine int)
insert into 
Library_Detail(Member_ID,Book_ID,Issue_Date,Return_Date,Total_Fine)
values(212,111,'2019-03-21','2019-03-28',0)
insert into 
Library_Detail(Member_ID,Book_ID,Issue_Date,Return_Date,Total_Fine)
values(211,121,'2019-03-19','2019-03-28',10)
insert into
Library_Detail(Member_ID,Book_ID,Issue_Date,Return_Date,Total_Fine)
values(213,135,'2019-03-17','2019-03-25',5)
insert into 
Library_Detail(Member_ID,Book_ID,Issue_Date,Return_Date,Total_Fine)
values(214,152,'2019-03-21','2019-03-28',0)
select * from Book_Detail31
select * from Student_Detail
select * from Library_Detail


Output:-




0 comments:

If you have any doubts,please let me know