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

Ip SQL Practicals

This document contains SQL queries run on various database tables like player, garment, store, school, students, and furniture. The queries select, update, insert and alter table data by filtering on columns, ordering results, finding aggregates, modifying structures and joining multiple tables. In summary, the document demonstrates basic to advanced SQL operations on multiple database tables.

Uploaded by

Aneri Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Ip SQL Practicals

This document contains SQL queries run on various database tables like player, garment, store, school, students, and furniture. The queries select, update, insert and alter table data by filtering on columns, ordering results, finding aggregates, modifying structures and joining multiple tables. In summary, the document demonstrates basic to advanced SQL operations on multiple database tables.

Uploaded by

Aneri Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1.

1.
mysql> select * from player where p_score=100 order by
p_score;
2.
mysql> update player set p_salary=p_salary + (p_salary *
10/100) where p_score=100;
3.

4.
mysql> select distinct p_city from player;
5.
mysql> insert into player values(8, 'Piyush', 'Kota', 90, 14000);
6.
mysql> select p_name from player where p_city='Jaipur'or
p_city='Tonk';
7.
mysql> ALTER TABLE player ADD coach_name varchar(30);
8.
mysql> select * from player order by p_salary desc;
2.
1.
mysql> select gcode, description from garment order by gcode;
2.
mysql> select * from garment where readydate between '2007-
12-08' and '2008-06-16';
3.
mysql> select avg(price) from garment where fcode='F03';
4.
mysql> select fcode, max(price), min(price) from garment group
by fcode;
5.
mysql> select description from garment where
length(description)=5 and description like "%ock";
6.
mysql> select description from garment where description like
"%Formal%" ;
7.
mysql> alter table garment modify column description char(50);
8.
mysql> alter table garment add column final_price int;
mysql> update garment set final_price=price+ (price * 10/100);
3.
1.
mysql> select * from store order by name;
2.
mysql> select city, noofemp from store where
noofemp>2;
3.
mysql> update store set sales_amt = sales_amt +
(sales_amt * 10/100) where noofemp>10 and
city='Mumbai';
4.

5.
mysql> select * from store where name like 's%' or
name like 'p%' or name like '%n';
6.
mysql> select max(sales_amt), min(sales_amt),city
from store group by city;
7.
mysql> select * from store where store_id = 'S101' or
store_id = 'S103' or store_id = 'S105';
4.
1.
mysql> select count(name) from school where class>2 group
by house;
2.
mysql> select avg(percentage), gender from school group by
gender;
3.
mysql> select min(percentage) from school where class=10;
4.
mysql> select * from school where name like 'a%' or name
like 'r%' or name like '%r' or name like '%a';
5.
mysql> select name from school where percentage between
80 and 90;
6.
mysql> select * from school order by percentage asc;
7.
mysql> select count(name),class from school where
gender='Male' group by class;
5.
1.
mysql> select name, marks from students order by marks asc;
2.
mysql> select rollno, name from students where
city='Moscow';
3.
mysql> select max(marks), min(marks), city from students
group by city;
4.
mysql> select count(name), city from students where
class='XI' group by city;
5.

6.
mysql> select name from students where class!='X';
7.
mysql> alter table students modify column name char(50);
8.
mysql> ALTER TABLE students
-> RENAME COLUMN rollno to rno;
6.
1.
mysql> select fcode, name , price from furniture where
price<5000;
2.
mysql> select name, price from furniture where name like
'%table%';
3.
mysql> select wcode from furniture group by wcode;
4.
mysql> select name, price+500 from furniture;
5.
mysql> select fcode, name from furniture order by fcode
desc;
6.
mysql> select avg(price) from furniture where wcode='W02';
7.
mysql> select max(price),wcode from furniture group by
wcode;
8.
mysql> select * from furniture where name like '_____e' or
name like '%e';

You might also like