- -- Q1: Retrieve First Name, Last Name and Salary From the Employees table whose salary is less than 6,000
- SELECT First_Name, Last_Name, Salary from hr.employees
- WHERE Salary<6000;
- -- Q2: Retrieve First Name, Last Name and Salary From the Employees table whose First_Name ends with p
- SELECT First_Name, Last_Name, Salary from hr.employees
- WHERE First_Name LIKE 'p%';
- -- Q3: Retrieve all the Employees Data from the table whose second alphabet in their First Name is i
- SELECT * from hr.employees
- WHERE First_Name LIKE '_i%';
- -- Q4: Retrieve the sum, average, minimum and maximum of the employee salaries, where ALIAS is being used to give them user-friendly names
- SELECT SUM(SALARY) AS SUM, AVG(SALARY) AS AVERAGE, MIN(SALARY) AS MINIMUM, MAX(SALARY) AS MAXIMUM from hr.employees;
- -- Q5: Retrieve all the data from employees table, whose salary is in the range of 2900 and 9000
- SELECT * from hr.employees
- WHERE SALARY BETWEEN 2900 AND 9000;
- -- Q6: Retrieve all the data from Regions table, where region ID is 1 and 4.
- SELECT * from hr.regions
- WHERE region_id=1 and region_id=4;
- -- Q7:
- desc hr.jobs;
Recent Pastes