Skip to main content

SQL Query Interview Questions

/* Return Employee record With highest Salary */

SELECT * from employee where salary = (SELECT Max(salary) from employee);

/* Select highest salary in employee table */

SELECT Max(salary) from employee;

/* Select 2nd highest salary from employee */

SELECT Max(salary) from employee where salary Not in (SELECT Max(salary) from employee)

/* select Range of employee based on id */


SELECT * FROM  employee where employee_id between 2003 and 2008

Comments