Answer to Question #223568 in Databases | SQL | Oracle | MS Access for Muqeet Waraich

Question #223568

User_ID

User_Name

Salary

Department

201

William

10000

MRKT

202

Michael

20000

HR

203

Anthony

30000

MRKT

204

Aiden

40000

HR

205

Matthew

50000

IT

 

Perform the following queries for above table:

1.    Write a SQL query to display User name who is taking maximum salary.

2.    Write a SQL query to display second highest salary from user table.

3.    Find names of user starting with ‘A’.

4.    Find number of users working in department ‘HR’.

5.    Print details of users whose name ends with ‘m’ and contains 6 Alphabets.

6.    Print details of users whose salary between 20000 and 50000.

7.    How many records do we have?

8.    write a query to find How many jobs do we have?     

  1. Write a query to find unique jobs from the user table.

10. Add Column Bonus Salary in usertable.

 

 



1
Expert's answer
2021-08-06T04:22:26-0400

1.

SELECT User_Name, MAX(Salary)
FROM Employees;


2.

SELECT MAX(salary)
FROM Employees
WHERE Salary IN
(SELECT Salary FROM Employees MINUS SELECT MAX(Salary) 
FROM Employees); 

3.

SELECT * 
FROM Employees 
WHERE User_Name LIKE 'A%';


4.

SELECT COUNT(User_ID)
FROM Employees
WHERE Department== "HR";

5.

SELECT * 
FROM Employees 
WHERE User_Name LIKE 'm%' AND LEN (User_Name)==6;


6.

SELECT *
FROM Employees
WHERE Salary BETWEEN 20000 AND 50000;


7.

SELECT COUNT(*) FROM Employees;


8.

SELECT COUNT(DISTINCT Department)
FROM Employees;


9.

SELECT DISTINCT Department
FROM Employees;


10.

ALTER TABLE Employees
ADD Bonus_Salary varchar(255);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS