Lowe’s Interview Questions | Query II
Question
Name | Designation | Joining_Date | Salary |
Ashutosh Singla | HR | 2019-12-15 | 80,000 |
Chandan Garg | Admin | 2019-10-09 | 60,000 |
Himanshi Kaur | HR | 2019-03-13 | 75,000 |
Mohit Dharm | HR | 2019-05-27 | 85,000 |
Meena Batra | Accountant | 2019-07-11 | 50,000 |
Omkar Singh | Accountant | 2019-01-05 | 45,000 |
Pratham Garg | Admin | 2019-05-27 | 65,000 |
Rakesh Sharma | HR | 2018-06-30 | 75,000 |
Sharadha Gupta | Accountant | 2019-09-18 | 50,000 |
The company has decided to give a pay raise of 5,000 to Accountants with a salary of less than 50,00. Find the employees satisfying the condition and create a new table with raised salaries.
in progress
1
SQL
55 years
7 Answers
1974 views
Great Grand Master 0
Answers ( 7 )
create table table_name as (
select name,designation,joining_date
,salary+5000 as salary from (
select * from table_name
where designation=’Accountants’
and salary <50000));
SELECT * FROM employees
WHERE designation = ‘Accountants’ AND salary <=50,000
select name, salary, (salary + 5000) as raised salary
from emploiyees
where designation = ‘Accountant’ and cast(replace(salary, ‘,’, ”), INT) < 5000
SELECT name, designation, (salary +5000) AS new_salary, joining_date
FROM table_name
WHERE designation=’accountant’ and salary<50000
create table table1(
SELECT name, designation, (salary +5000) AS new_salary, joining_date
FROM table_name
WHERE designation=’accountant’ and salary<50000);
create table new_table as (
select Name, Designation,Joining_date, case when designation=’Accountant’ and salary<50000 then salary+5000 else salary end as salary
)
With cte_new_sal_table as (
select * ,
case
when salary < 50000 and designation = 'Accountant' then salary+5000
else salary
end as new_salary
from table
)
creat table new_table as
select name,
designation
,joining_date
,case when designation = ‘Accountant’ and salary <50000 then salary + 5000
else salary end as salary
from
table