PostgreSQL Restricting and Sorting Data: Display the jobs/designations available in the employees table
9. Write a query to display the jobs/designations available in the employees table.
Sample Solution:
Code:
SELECT DISTINCT job_id
FROM employees;
Sample table: employees
Output:
pg_exercises=# SELECT DISTINCT job_id pg_exercises-# FROM employees; job_id ------------ AC_ACCOUNT ST_MAN IT_PROG SA_MAN AD_PRES AC_MGR FI_MGR AD_ASST MK_MAN PU_CLERK HR_REP PR_REP FI_ACCOUNT SH_CLERK AD_VP SA_REP ST_CLERK MK_REP PU_MAN (19 rows)
Relational Algebra Expression:
Relational Algebra Tree:
Practice Online
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a query to display the last name of employees having 'e' as the third character.
Next: Write a query to display the name, including first_name, last_name, salary and 15% of salary as PF of all employees.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics