SQL Query 01

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

SQL Query Question Set - 1

1 Display employees whose salary is equal to 7000.

2 Display employees having salaries less than 2400 and hiring year greater than 2005.

3 Display all employees in IT or Accounting department.

4 How to display employees whose salary is between 1500 and 2500 without using between operators?

5 Display employees whose COMMISION_PCT is other than 0.10.

6 Delete employees from department Purchasing and salary less than 2500.

7 Display first name, last name and salary of an employee who is having a max salary.

8 What is the Query to fetch the last record from the employees table?

9 What is the Query to fetch the first record from the Employee table?

10 What is Query to display the last 5 Records from the Employee table?

11 Display Odd rows in Employee table

12 Display Even rows in Employee table

13 Display total count of Employees.

14 Display department Wise total count of Employees.

15 Display region Wise total count of Employees.

16 Display the list of employees having the first names ‘David’ or ‘Diana’ without using like, in,and or operators.
(Hint Any/ All Operator)
17 Display department name having the sum of employees salary is greater than 2500 and employees count is
less than 10
18 Write SQL query to update employees’ salary by 15% and the Region of employees should be Asia

19 Write SQL query to create the EMPLOYEES_1 table, which is exact replica of the Employees table

20 Write SQL query to find the current experience of employees.

21 Write a query to display a list of employees having a salary greater than Max salary defines for respective
JOB_ID.
22 Write a query to count the number of rows in the table without using the count function?

23 Write a query to display department-wise max salary Output columnsà EMP_ID, FIRST_NAME, SALARY,
DEPARTMENT
24 Write a query to display department-wise 2nd max salary Output columns EMP_ID, FIRST_NAME, SALARY,
DEPARTMENT
25 From string 'Firstname_lastname@gmail.com, display only Firstname_lastname

26 dd/mm/yyyy format in table, we want to display employee who joined in year 2008
27 4th max salary

28 What will be the query for delete rows from the table

29 Write query to display employee name with their previous designation and year

30 How to display duplicate records

31 Suppose there is column contains 1.aShok 2.Ashok 3.ASHOK 4.aSHOKE 5.santosh 6.vinayak and we have
to display a= 4, s= 1 and v= 1
32 I want output like pravin trainee, sr.engg, lead. What will be the query

33 There are 10 records in table out of which 4 are duplicate, if we delete duplicate records then how many
records will remains in table
34 Add column in existing table

35 Display patient according to their city

36 Display total expence of patients based on their cities

37 Display patient name starts with s and ends with a

38 How to check how many columns present in table

39 Display city name from city column which ends with 'pur'

40 How to display PUr as puR

41 Display first three letter from city_name column

42 How we can join two column

43 Calculate total salary which is sum of salary and commision, if in commision column we have null value then
how it will be calculated
44 DISPLAY NTH RECORDS"

45 DISPLAY THE 1 AND LAST RECORDS FROM THE TABLE"

46 DISPLAY DISTINCT SALARY FROM TABLE "

47 HOW TO JOIN A 5 TABLE "

48 HOW TO COPY TABLE STRUCTURE FROM ONE TO ANOTHER"

49 HOW TO DELETE DUPLICATE RECORDS"

50 display positive and negative values from the particular records"

51 how to update salary by 10 % increament

52 how to get three max salaries"

53 DISPLAY THE SUM OF SALARY DEPARMENT WISE"

54 RETRIVE RECORDS FROM TABLE 1 NOT PRESENT IN TABLE 2 "


55 HOW TO FIND NULL VALUE FROM RECORD"

56 DISPLAY THE TOP 10 RECORDS FROM TABLE"

57 Write sql query to create the table

58 SEELCT SALARY FROM 3 TO 6 HIGH"

59 SELECT SALARY BETWWEN RANK (3,4,6,7,9)"

60 SELECT SALARY NOT BETWEEN 3 AND 6"

61 SELECT SALRY BETWEEN 3 AND 6 "

62 department wise total salry"

63 display total records from the table"

64 display rownum"

65 How to remove table from database ?

66 How to find unique names from table ?

67 write query to find sencond higest score from table

68 List the costomer name which contain 'e'

69 In bank data base we have four table as 1.Loan 2.fraud_counstomer 3.FD_coustomer 4.Coustomer master
table We need to find out a)all the FD_coustomers and Loan_coustomers b)List all the FD_coustomers
including the coustomers who have taken loan and the amount of loan C) all the coustomers who hav
come in all three categories
70 RETURN TO MAXIMUM SALARY FROM THE TABLE"

71 RETURN TO THE LOWEST SALARY"

72 DISPLAY THE HIGHEST SALRY GROUP WISE"

73 RETURN TO THE DEPARTMENT WISE MIN SALARY"

74 HOW TO DISPLAY SECOND MAX SAL FROM TABLE"

75 HOW TO DIPLLAY THIRD MAX SAL FROM TABLE"

76 RANKING THE SALARY FROM HIGH TO LOW"

77 DISPLAY 4 FOURTH MAX SALARY FROM TABBLE"

78 DISPLAY 16TH MAX SALARY FROM TABLE"

79 LIKE WISE FRO 100TH HIGHEST SALARY"

80 FIRST FIVE HIGHEST SALRY"

81 HOW TO DISPLAY TABLE INFO


82 In bank data base we have four table as 1.Loan 2.fraud_counstomer 3.FD_coustomer 4.Coustomer master
table We need to find out a)Categorise the coustomer into low risk, medium risk and high risk b)Print the
list of all coustomers including the coustomer who have taken loan and the amount of loan
83 Write the query to get second heighest salary and if there is no second higest salary the query should return
null
84 Find the employees who has highest salary in each deapartment and the result should be contains
Employee_name, Department_name, Salary.
85 Write a query to find median from the arrey of numbers

86 Write a query to display EMPLOYEES having ID 101,102,103 as per the below order: (Hint:

Union Operator / Case Statement)

1. 101

2. 103

3. 102

87 One column contains 'null values', we have to replace null values by 'unknown'

88 Query fro create table and create stored procedure

You might also like