Pages

Monday, 24 February 2020

Top 11 SQL/Sybase/Oracle query for SDET/Developers/Automation Testing SET 01?

SQL


 As SQL is quite vast so I will post interview questions on SQL query in three sets, below is the set-10:

1.     Write An SQL Query To Print Details Of The EMPLOYEEs Whose FIRST_NAME Ends With ‘A’.

Select * from EMPLOYEE where FIRST_NAME like '%a';
2.     Write An SQL Query To Print Details Of The EMPLOYEEs Whose FIRST_NAME Ends With ‘H’ And Contains Six Alphabets.

Select * from EMPLOYEE where FIRST_NAME like '_____h';
3.     Write An SQL Query To Print Details Of The EMPLOYEEs Whose SALARY Lies Between 100000 And 500000.

Select * from EMPLOYEE where SALARY between 100000 and 500000;
4.     Write An SQL Query To Print Details Of The EMPLOYEEs Who Have Joined In Feb’2014.

Select * from EMPLOYEE where year(JOINING_DATE) = 2014 and month(JOINING_DATE) = 2

5.     Write An SQL Query To Fetch EMPLOYEE Names With Salaries >= 50000 And <= 100000.

Select FIRST_NAME, SALARY from EMPLOYEE where SALARY between 50000 And  100000.

6.     Write An SQL Query To Fetch The No. Of EMPLOYEEs For Each Department In The Descending Order.


SELECT DEPARTMENT, count(EMPLOYEE_ID) No_Of_EMPLOYEEs
FROM EMPLOYEE
GROUP BY DEPARTMENT
ORDER BY No_Of_EMPLOYEEs DESC;

7.     Write An SQL Query To Print Details Of The EMPLOYEEs Who Are Also Managers.

SELECT EMPLOYEE.EMPLOYEE_ID,EMPLOYEE.DEPARTMENT,EMPLOYEE.FIRST_NAME ,Title.EMPLOYEE_TITLE Title from EMPLOYEE Inner Join Title
on EMPLOYEE.EMPLOYEE_ID=Title.EMPLOYEE_Ref_ID  where Title.EMPLOYEE_TITLE='Manager' order by EMPLOYEE_ID


8.    Write An SQL Query To Fetch Duplicate Records Having Matching Data In Some Fields Of A Table.

SELECT EMPLOYEE_TITLE, AFFECTED_FROM, COUNT(*)
FROM Title
GROUP BY EMPLOYEE_TITLE, AFFECTED_FROM
HAVING COUNT(*) > 1;


9.    Write An SQL Query To Show Only Odd Rows From A Table.

SELECT * FROM Emplyee WHERE MOD (EMPLOYEE_ID, 2) <> 0;
10.  Write An SQL Query To Show Only Even Rows From A Table.

SELECT * FROM EMPLOYEE WHERE MOD (EMPLOYEE_ID, 2) = 0;

      11. Write An SQL Query To Determine The Nth (Say N=5) Highest Salary From A Table.

      SELECT Salary FROM EMPLOYEE ORDER BY Salary DESC LIMIT n-1,1;




Lean Cucumber/BDD commands in below link:

CUCUMBER COMMANDS 
 

*************************************************

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. 1. Write An SQL Query To Print Details Of The EMPLOYEEs Whose FIRST_NAME Ends With ‘A’.

    Select * from EMPLOYEE where FIRST_NAME like 'a%';

    ReplyDelete