w3resource

SQLite JOINS - Exercises, Practice, Solution

SQLite Joins [11 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]

1. Write a query to find the addresses (location_id, street_address, city, state_province, country_name) of all the departments.
Hint : Use NATURAL JOIN.

Sample table : locations


Sample table :countries


Click me to see the solution

2. Write a query to find the names (first_name, last name), department ID and the name of all the employees.

Sample table : employees


Sample table : departments


Click me to see the solution

3. Write a query to find the employee id, name (last_name) along with their manager_id, manager name (last_name).

Sample table : employees


Click me to see the solution

4. Write a query to find the names (first_name, last_name) and hire date of the employees who were hired after 'Jones'.

Sample table : employees


Click me to see the solution

5. Write a query to get the department name and number of employees in the department.

Sample table : employees


Sample table : departments


Click me to see the solution

6. Write a query to find the employee ID, job title number of days between ending date and starting date for all jobs in department 90 from job history.

Sample table : employees


Click me to see the solution

7. Write a query to display the department ID, department name, and manager first name.

Sample table : employees


Sample table : departments


Click me to see the solution

8. Write a query to display the department name, manager name, and city.

Sample table : employees


Sample table : departments


Sample table : locations


Click me to see the solution

9. Write a query to display the job title and average salary of employees.

Sample table : employees


Click me to see the solution

10. Write a query to to display job title, employee name, and the difference between the salary of the employee and minimum salary for the job.

Sample table : employees


Click me to see the solution

11. Write a query to display the job history that was done by any employee who is currently drawing more than 10000 of salary.

Sample table : employees


Sample table : Job_history


Click me to see the solution

... More

Structure of 'hr' database :

hr database


Become a Patron!

Follow us on Facebook and Twitter for latest update.

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/sqlite-exercises/sqlite-join-exercises.php