AdventureWorks Database: Create a list of unique jobtitles

SQL Query - AdventureWorks: Exercise-6 with Solution

6. From the following table write a query in SQL to create a list of unique jobtitles in the employee table in Adventureworks database. Return jobtitle column and arranged the resultset in ascending order.

Sample table: humanresources.employee

Click to view Full table

Sample Solution:

FROM humanresources.employee  
ORDER BY jobtitle;

Sample Output:

jobtitle                                |
Accountant                              |
Accounts Manager                        |
Accounts Payable Specialist             |
Accounts Receivable Specialist          |
Application Specialist                  |
Assistant to the Chief Financial Officer|
Benefits Specialist                     |
Buyer                                   |
Chief Executive Officer                 |
Chief Financial Officer                 |
Control Specialist                      |
Database Administrator                  |
Design Engineer                         |
Document Control Assistant              |

SQL AdventureWorks Editor:

Practice Online

Contribute your code and comments through Disqus.

Previous: Calculate the percentage of tax on subtotal.
Next: Calculate the total freight paid by each customer.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Share this Tutorial / Exercise on : Facebook and Twitter

SQL: Tips of the Day

How to create a foreign key in SQL Server?

create table question_bank
    question_id uniqueidentifier primary key,
    question_exam_id uniqueidentifier not null,
    question_text varchar(1024) not null,
    question_point_value decimal,
    constraint fk_questionbank_exams foreign key (question_exam_id) references exams (exam_id)

Database: SQL Server

Ref : https://bit.ly/3sgS152