KnowledgeBoat Logo

Computer Science

Consider the table Personal given below:

Table: Personal

P_IDNameDesigSalaryAllowance
P01RohitManager890004800
P02KashishClerkNULL1600
P03MaheshSuperviser48000NULL
P04SalilClerk310001900
P05RavinaSuperviserNULL2100

Based on the given table, write SQL queries for the following:

(i) Increase the salary by 5% of personals whose allowance is known.

(ii) Display Name and Total Salary (sum of Salary and Allowance) of all personals. The column heading 'Total Salary' should also be displayed.

(iii) Delete the record of personals who have salary greater than 25000.

SQL Queries

2 Likes

Answer

(i)

UPDATE Personal
SET Salary = Salary + Salary * 0.5
WHERE Allowance IS NOT NULL;

(ii)

SELECT Name, Salary + Allowance AS 
"Total Salary" FROM Personal;

(iii)

DELETE FROM Personal
WHERE Salary > 25000;

Answered By

2 Likes


Related Questions