DBMS Query Questions.
DBMS Query Questions.
1 Suman 20000
2 Sanjay 32000
3 Ravi 30000
a. Display the salary of all the employees after incrementing by Rs 1000.
Ans. Select Salary +1000 from Emp;
b. Display the Employee id and salary of all the employees after decreasing by
Rs 500.
Ans. Select Emp_id, Salary – 500 from Emp;
c. Display the Name and salary of all the employees after incrementing it as
thrice the amount of present salary.
Ans. Select Ename, Salary * 3 from Emp;
d. Display the Employee id, Name and salary of all the employees after
decrementing it as half the amount of present salary.
Ans. Select Emp_id, Ename, Salary/2 from Emp;
e. Display the Employee id and Name of all the employees.
Ans. Select Emp_id, Ename from Emp;
12 Pen 10 17
13 Eraser 5 15
14 Notebook 15 20
b. Write a query to display detail of items whose quantity is more than 10.
Ans. Select * from Item where Qty > 10
j. Write a query to decrease the price of all items by Rs2 whose price is less
than 20.
Ans. Update Item set Price = Price – 2 where Price < 20;
i. Display Sales ID and price of all products whose discount is more than
1000.
Answer: select Sale_Id, Price from Sales where Discount > 1000;
iii. Display product name and sales price after deducting the discount from the
price.
Note: Sales price can be calculated as (price-discount)
Answer: select Prod_Name, Price- Discount from Sales;