Home » Technical Interview Questions » SQL Interview Questions » SQL Query Interview Questions

SQL Query Interview Questions


Reading Time - 0 mins

41. Get employee details from employee table whose Salary less than 800000?

SELECT * FROM EMPLOYEE WHERE SALARY <800000;

42. Get employee details from employee table whose Salary between 500000 and 800000?

SELECT * FROM EMPLOYEE WHERE SALARY BETWEEN 500000 AND 800000;

SQL DATE Functions

43. Get employee details from employee table whose joining year is “2013”?

 SELECT * FROM EMPLOYEE
 WHERE TO_CHAR (JOINING_DATE, 'YYYY')='2013';

44. Get employee details from employee table whose joining month is “January”?

SELECT * FROM EMPLOYEE WHERE TO_CHAR(JOINING_DATE,'MM')='01'

OR
SELECT * FROM EMPLOYEE WHERE TO_CHAR(JOINING_DATE,'MON')='JAN';

45. Get employee details from employee table who joined before January 1st 2013?

SELECT * FROM EMPLOYEE WHERE JOINING_DATE <TO_DATE('01/01/2013','DD/MM/YYYY');

46. Get employee details from employee table who joined after January 31st?

SELECT * FROM EMPLOYEE WHERE JOINING_DATE >TO_DATE('31/01/2013','DD/MM/YYYY');

47. Get Joining Date and Time from employee table?

SELECT TO_CHAR(JOINING_DATE,'DD/MM/YYYY HH:MI:SS') FROM EMPLOYEE;

48. Get Joining Date,Time including milliseconds from employee table?

SELECT TO_CHAR(JOINING_DATE,'DD/MM/YYYY HH:MI:SS.FF') FROM EMPLOYEE ;

Here          column             Data          Type should            be            “TimeStamp”

49. Get difference between JOINING_DATE and INCENTIVE_DATE from employee and incentives table?

SELECT FIRST_NAME,INCENTIVE_DATE - JOINING_DATE
FROM EMPLOYEE A INNER JOIN INCENTIVES B
        ON A.EMPLOYEE_ID=B.EMPLOYEE_REF_ID;

50. Get database date?

SELECT SYSDATE FROM DUAL;

READ  Parameterized Query in SQL
Array Interview Questions
Graph Interview Questions
LinkedList Interview Questions
String Interview Questions
Tree Interview Questions