0% found this document useful (0 votes)
95 views

Code

The document contains SQL statements that create tables, insert data, and perform queries on two tables: book and member. It also creates a Gym table, inserts data, and performs additional queries on the Gym table. The tables store information about books, book borrowers, and gym members. Queries are performed to return book information, member details based on borrow date, gym members meeting criteria like fees paid and gender, and aggregations on the Gym table.

Uploaded by

Avinash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Code

The document contains SQL statements that create tables, insert data, and perform queries on two tables: book and member. It also creates a Gym table, inserts data, and performs additional queries on the Gym table. The tables store information about books, book borrowers, and gym members. Queries are performed to return book information, member details based on borrow date, gym members meeting criteria like fees paid and gender, and aggregations on the Gym table.

Uploaded by

Avinash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Create table book(

Code varchar (10),


BName varchar(10),
Type varchar(10));

Insert into book values("F101","The Priest","Fiction");


Insert into book values("L102","German Easy","Literature");
Insert into book values("C101","Tarzan in The Lost World","Comic");
Insert into book values("F102","Untold Story","Fiction");
Insert into book values("C102","War Heroes","Comic");

Create table Member(


MNO varchar(10),
MName varchar(20),
Code varchar(20),
IssuedDate date);

Insert into member values("M101","Raghav Sinha","L102","2016-10-13");


Insert into member values("M103","Sarthak John","F102","2017-02-23");
Insert into member values("M102","Anisha Khan","C101","2016-06-12");

select*from member
order by IssuedDate desc;

Select Code ,BName from book


where Type="Fiction";

Select Type,Count(Code) From Book


group by Type;

Select MName,IssuedDate from member


where IssuedDate Like"%2017%";

Create Table Gym(Mcode int(3),


MName char(10),
Gender Varchar (10),
Age int(5),
FeeGiven int(10),
Type varchar(20)
DtAdmit date);

Insert into gym values(1,"Amit","Male",35,6000,"Monthly","2016-01-23");


Insert into gym values(2,"Rashmi","Female",25,8000,"Monthly","2016-09-23");
Insert into gym values(3,"George","Male",42,24000,"Yearly","2011-06-27");
Insert into gym values(4,"Fawad","Male",27,12000,"Quarterly","2012-10-16");
Insert into gym values(5,"Samit","Male",54,6000,"Monthly","2015-09-20");
Insert into gym values(6,"Laksmi","Female",43,4500,"Monthly","2016-01-15");
Insert into gym values(7,"Samita","Female",22,500,"Guest","2017-01-23");
Insert into gym values(8,"Michael","Male",51,24000,"Yearly","2013-07-18");
Insert into gym values(9,"DayaChand","Male",44,100000,"Life","2012");
Insert into gym values(10,"Ajit","Male",33,12000,"Quarterly","2015-06-26");

Select MName,Age,Feegiven from GYm


where fee>12000;

select Mcode,MName,Age From gym


where gender="Female"
order by age desc;

Select MName,DtAdmit from GYm


Where DtAdmit>"2015-12-31";

Select Count(MName),Type from Gym


group by type;

Select MName,FeeGiven from Gym


where age<40 and Type="Monthly";

Select Max(fees),Min(fees),Type from Gym


group by Type;

Select MName from Gym


where MName like"%mit%";

select distinct Type from Gym;

You might also like