Friday, October 30, 2020

Top SQL interview question and Answer for SDET/Manual Testers - Set 1

 





Queries based on the above tables:

Simple Queries:

1. List all the employee details
SQL > Select * from employee;

2. List all the department details
SQL > Select DEPARTMENT_ID from Employee;

3. List all job details
SQL > Select JOB_ID from Employee;

4. List all the locations
SQL > Select loc from Employee;

5. List the latest updated record
SELECT TOP 1 * FROM Employee ORDER BY EMPLOYEE_ID DESC
OR
SELECT TOP 1 * FROM Employee ORDER BY HIREDATE DESC
OR
select * from Employee where HIREDATE=(select max(HIREDATE) from Employee)

6. List out first name, last name, salary, commission for all employees
SQL > Select first_name, last_name, salary, commission from employee;

7. List out employee_id,last name,department id for all employees and rename employee id as “ID of the employee”, last name as “Name of the employee”, department id as “department ID”

SQL > Select employee_id “id of the employee”, last_name “name", department id as “department id” from employee;

8. List out the employees anual salary with their names only.

SQL > Select last_name, salary*12 “annual salary” from employee

No comments:

Post a Comment

How to install Java on EC2

***************************************** How to install Java on EC2 ***************************************** To be continued, In this post...

All Time Popular Post