Emp_id ename salary
1 Suman 20000
2 Sanjay 32000
3 ravi 30000
Table:empl
1.display the all the elements from the table.
=SELECT *from empl;
2.display emp_id,salary from the table.
=select emp-id,salary from empl;
3.display the salary of all the employees after incrementing by rs 1000.
=select salary+1000 from empl;
4. display the salary,ename of all the employees after decreasing by rs 500.
=select ename,salary-500 from empl;
5.display the name and salary of all the employees after incrementing it as thrice the amount of
present salary.
=select ename,salary*3 from empl;
6. display the name and salary of all the employees after decrementing it as half the amount of
present salary.
=select ename,salary/2 from empl;
Table:student
admno name class house
1001 Sonam 9 Blue
1002 Ravi 10 Yellow
1003 poonam 10 green
1.display entire table.
=select * from student;
2.display the list of the students whose house color is blue.
=select * from student where house=’blue’;
3.display the admission number of students whose house color is green.
=select admno from student where house=’green’;
4.to view records(row) in ascending order of admission display.
=select* from student orderby admno;
4.to view records(row) of name ,class in ascending order of admission display.
==select name,class from student orderby admno;
5.display the records of class 10 students.
=select * from student where class=10;
6.display the class of ‘ravi’.
=select class from student name=’ravi’;
7.insert the given record:
1004,”Amaan”,11,’blue’
=insert into student values(1004,’amman’,11,’blue’);
Table:item
itemno itemname price Qty
12 Pen 10 17
13 Eraser 5 15
14 Notebook 15 20
1.write a query to display detail of items whose quantity is more than 10.
=select * from item where qty>10;
2.write a query to insert a new record of following details
15,”pencil”,20,10
=insert into item values(15,”pencil”,20,10);
3. write a query to insert a new field(column) as quality,A,B,A
=Alter table item ADD(quality varchar(100),A char(10), B char(10),C char(10));
4.Write a query to change the quantity of item number 13 to 25.
=update item set qty=25 where itemno=13;
5.display the total amount of each item. The amount must be calculated as the price multiplied by
quantity for each item.
=select price *qty from item;
6.display all the records in descending order of price.
=select* from item orderby price desc;
Table: book
bkid bkname author qty price
101 Abc Amal 5 100
103 Cs Kushi 4 500
104 Eng Riya 5 400
106 Maths Rai 4 300
110 sci tania 5 500
1.display data of all books whose quantity is more than 3.
=select * from book where qty>3;
2.display the total amount of all books whose price is less than 500.(hints:Amount=qty*price)
=select qty*price from book where price<500;