SQL Queries Interview Questions and Answers - Query Examples
Get all employee details from the employee table
Get First_Name,Last_Name from employee table

Get First_Name from employee table using alias name “Employee Name”
Get First_Name from employee table in upper case
Get First_Name from employee table in lower case
Get unique DEPARTMENT from employee table
Select first 3 characters of FIRST_NAME from EMPLOYEE
Get position of ‘o’ in name ‘John’ from employee table
Get FIRST_NAME from employee table after removing white spaces from left side
Get length of FIRST_NAME from employee table
Get First_Name from employee table after replacing ‘o’ with ‘$’
Get First_Name and Last_Name as single column from employee table separated by a ‘_’
Get FIRST_NAME ,Joining year,Joining Month and Joining Date from employee table
Get all employee details from the employee table order by First_Name Ascending
Get all employee details from the employee table order by First_Name descending
Get all employee details from the employee table order by First_Name Ascending and Salary descending
Get employee details from employee table whose employee name is “John”
Get employee details from employee table whose employee name are “John” and “Roy”
Get employee details from employee table whose employee name are not “John” and “Roy
Get employee details from employee table whose first name starts with ‘J’
Get employee details from employee table whose first name contains ‘o’
Get employee details from employee table whose first name ends with ‘n’
Get employee details from employee table whose first name ends with ‘n’ and name contains 4 letters
Get employee details from employee table whose first name starts with ‘J’ and name contains 4 letters
Get employee details from employee table whose Salary greater than 600000
Get employee details from employee table whose Salary less than 800000
Get employee details from employee table whose Salary between 500000 and 800000
Get employee details from employee table whose name is ‘John’ and ‘Michael’
Get employee details from employee table whose joining year is “2013”
Get employee details from employee table whose joining month is “January”
Get employee details from employee table who joined before January 1st 2013
Get employee details from employee table who joined after January 31st
Get Joining Date and Time from employee table
Get Joining Date,Time including milliseconds from employee table
Get difference between JOINING_DATE and INCENTIVE_DATE from employee and incentives table
Get database date
Get department,total salary with respect to a department from employee table.
Get department,total salary with respect to a department from employee table order by total salary descending
Get department,no of employees in a department,total salary with respect to a department from employee table order by total salary descending
Get department wise average salary from employee table order by salary ascending
Get department wise maximum salary from employee table order by salary ascending

Tags: , ,