PostgreSQL Basic Simple - Exercises, Practice, Solution
PostgreSQL Basic Simple [19 exercises with solution]
1. Write a query to display the names (first_name, last_name) using an alias name “First Name", "Last Name".
Sample table: employees
2. Write a query to get a unique department ID from employee table.
Sample table: employees
3. Write a query to get the details of all employees from the employee table in descending order by their first name.
Sample table: employees
4. Write a query to get the names (first_name, last_name), salary and 15% of salary as PF for all the employees.
Sample table: employees
5. Write a query to get the employee ID, names (first_name, last_name) and salary in ascending order according to their salary.
Sample table: employees
Sample table: departments
6. Write a query to get the total salaries payable to employees.
Sample table: employees
7. Write a query to get the maximum and minimum salary paid to the employees.
Sample table: employees
8. Write a query to get the average salary and number of employees are working.
Sample table: employees
9. Write a query to get the number of employees working with the company.
Sample table: employees
10. Write a query to get the unique number of designations available in the employees table.
Sample table: employees
11. Write a query to get all the first name from the employees table in upper case.
Sample table: employees
12. Write a query to get the first three characters of the first name for all the employees in the employees table.
Sample table: employees
13. Write a query to calculate the expression 171*214+625.
14. Write a query to get the name, including first name and last name of all the employees from employees table.
Sample table: employees
15. Write a query to get the first names after removing all the leading and trailing blanks of all the employees from employees table.
Sample table: employees
16. Write a query to get the first name, last name and the length of the name, including first_name and last_name of all the employees from employees table.
Sample table: employees
17. Write a query to check whether the first_name column of the employees table containing any number.
Sample table: employees
18. Write a query to select first ten records from a table.
Sample table: employees
19. Write a query to get a monthly salary (rounded up to 2 decimal places) of each employee.
Note : Assume the salary field provides the 'annual salary' information.
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/basic/index.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics