p6
“Aggregate Functions &DML” Queries Q.1
Ans- INPUT:
• SELECT SUM(Amount) AS Total_Deposit FROM Deposit;
OUTPUT:
Q.2 Give maximum loan given to the Borrow.
Ans- INPUT:
• SELECT MAX(Amount) AS Maximum Loan FROM Borrow;
OUTPUT:
Q.3 Describe the average age of all the sailors.
Ans- INPUT:
SELECT AVG(Age) AS Average_Age FROM Sailors;
OUTPUT:
Q.4 Count total number of customers.
Ans-INPUT:
• SELECT COUNT (*) AS Total_Customers FROM Customers;
OUTPUT:
Q.5 Count total number of customer's cities.
Ans- INPUT:
• SELECT COUNT (DISTINCT City) AS Total_Cities FROM Customers;
OUTPUT:
Q.6 Display total target for the salesman.
Ans- INPUT:
SELECT SUM(Tgt) AS Total_Target FROM Salesman; OUTPUT:
Q.7 Update the salary of the Work having 10000 to 11500.
Ans- INPUT:
• UPDATE Work SET Salary = 11500 WHERE Salary = 10000;
OUTPUT:
Q.8 Update the city of client from Bangalore to Bengaluru.
Ans- INPUT:
• UPDATE Client SET City = 'Bengaluru' WHERE City = 'Bangalore'
OUTPUT:
Q.9 Give a 15% hike in the salary of all the Employees. Rename that column to "New Salary".
Ans- INPUT:
• SELECT Salary * 1.15 AS "New Salary" from Work;
OUTPUT:
Q.10 Increase the sell price of all products by 20% and label the new column as "New Sell Price".
Ans- INPUT
• Select Salary * 1.15 AS "New Salary" from Product; OUTPUT: