TEXT 25
Sql mid Guest on 6th April 2021 12:37:14 PM
  1.  
  2. -- Q1: Retrieve First Name, Last Name and Salary From the Employees table whose salary is less than 6,000
  3. SELECT First_Name, Last_Name, Salary from hr.employees
  4. WHERE Salary<6000;
  5.  
  6. -- Q2: Retrieve First Name, Last Name and Salary From the Employees table whose First_Name ends with p
  7. SELECT First_Name, Last_Name, Salary from hr.employees
  8. WHERE First_Name LIKE 'p%';
  9.  
  10. -- Q3: Retrieve all the Employees Data from the table whose second alphabet in their First Name is i
  11. SELECT * from hr.employees
  12. WHERE First_Name LIKE '_i%';
  13.  
  14. -- Q4: Retrieve the sum, average, minimum and maximum of the employee salaries, where ALIAS is being used to give them user-friendly names
  15. SELECT SUM(SALARY) AS SUM, AVG(SALARY) AS AVERAGE, MIN(SALARY) AS MINIMUM, MAX(SALARY) AS MAXIMUM from hr.employees;
  16.  
  17. -- Q5: Retrieve all the data from employees table, whose salary is in the range of 2900 and 9000
  18. SELECT * from hr.employees
  19. WHERE SALARY BETWEEN 2900 AND 9000;
  20.  
  21. -- Q6: Retrieve all the data from Regions table, where region ID is 1 and 4.
  22. SELECT * from hr.regions
  23. WHERE region_id=1 and region_id=4;
  24.  
  25. -- Q7:
  26. desc hr.jobs;

Coding Base is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.