SQL Questions
SQL Questions
52) SQL query to fetch all the Employees from EmployeeDetails who
joined in the Year 2020.
55) Fetch employee names and salaries even if the salary value is not
present for the employee.
56) Write an SQL query to fetch all the Employees who are also
managers.
58) Write an SQL query to fetch only odd rows from the table.
59) Write a query to fetch employee names and salary records. Display
the employee details even if the salary record is not present for the
employee.
60) Write an SQL query to join 3 tables.
61) Write an SQL query to fetch all the Employees who are also
managers from the Employee Details table.
62) Write an SQL query to fetch only odd rows from the table.
63) Write an SQL query to fetch only even rows from the table.
64) What is the Query to fetch first record from Employee table?
65) What is the Query to fetch last record from the table?
Answer:-
Select *
from Emp
where Rowid= select max(Rowid)
from Emp;
Select rownum,E.*
from Emp E
from Emp);
66) find the salaries of all employees with the name 'SM%'
SELECT *
FROM EMP
WHERE ROWNUM<=3;
70) Display last 5 records of employee table?
SELECT *
FROM EMP E1
WHERE 5 > (SELECT COUNT(*)
FROM EMP
27. LIST ALL THE DEPTNAME AND LOC OF ALL THE SALESMAN
MANAGER-MANAGER'S
32. LIST ALL THE EMPLOYEES WHOSE JOB IS SAME AS JONES AND
THEIR SALARY LESSER THAN SCOTT
34.DISPLAY ALL THE EMPLOYEES WHO ARE EARN LESS THAN ANY
OF THE SALESMAN? 35.DISPLAY ALL THE EMPLOYEES WHO ARE
JOINED BEFORE THE LAST PERSON?
103. DISPLAY ALL THE CLERKS AND ANALYST WHO ARE NOT
WORKING FOR 'DALLAS'
110. SELECT EMPNO, JOB AND SALARY OF ALL THE ANALYST WHO
ARE EARNING MORE THAN ANY OF THE MANAGER(JOB)
6.WADTD DNAME AND JOB FOR ALL THE EMPLOYEES WHOS JOB
AND DNAME STARTS WITH CHARACTER 'S'
17. LIST THE DNAME WHO ARE NOT HAVING ANY EMPLOYEE IN IT
26. DISPLAY EMPLOYEE NAME AND HIS DEPT NAME FOR THE
EMPLOYEES WHOSE NAME STARTS WITH ‘S’.