PostgreSQL Restricting and Sorting Data - Exercises, Practice, Solution
PostgreSQL Restricting and Sorting Data [11 exercises with solution]
1. Write a query to display the name, including first_name and last_name and salary for all employees whose salary is out of the range between $10,000 and $15,000.
Sample table: employees
2. Write a query to display the name, including first_name and last_name, and department ID who works in the department 30 or 100 and arrange the result in ascending order according to the department ID.
Sample table: employees
3. Write a query to display the name, including first_name and last_name, and salary who works in the department either 30 or 100 and salary is out of the range between $10,000 and $15,000.
Sample table: employees
4. Write a query to display the name, including first_name and last_name and hire date for all employees who were hired in 1987.
Sample table: employees
5. Write a query to get the first name of the employee who holds the letter 'c' and 'e' in the first name.
Sample table: employees
Sample table: departments
6. Write a query to display the last name, job, and salary for all those employees who hasn't worked as a Programmer or a Shipping Clerk, and not drawing the salary $4,500, $10,000, or $15,000.
Sample table: employees
7. Write a query to display the last names of employees whose name contain exactly six characters.
Sample table: employees
8. Write a query to display the last name of employees having 'e' as the third character.
Sample table: employees
9. Write a query to display the jobs/designations available in the employees table.
Sample table: employees
10. Write a query to display the name, including first_name, last_name, salary and 15% of salary as PF of all employees.
Sample table: employees
11. Write a query to select all information of employees whose last name is either 'JONES' or 'BLAKE' or 'SCOTT' or 'KING' or 'FORD'.
Sample table: employees
... More
Structure of 'hr' database :
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/postgresql-exercises/restricting-and-sorting-data/index.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics