Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

SQLite basic SELECT statement - Exercises, Practice, Solution

Basic SELECT statement [18 exercises with solution]

1. Write a query to display the names (first_name, last_name) using alias name "First Name", "Last Name" Go to the editor

Sample table : employees


Click me to see the solution

2. Write a query to get unique department ID from employee table. Go to the editor

Sample table : employees


Click me to see the solution

3. Write a query to get all employee details from the employee table order by first name, descending. Go to the editor

Sample table : employees


Click me to see the solution

4. Write a query to get the names (first_name, last_name), salary, PF of all the employees (PF is calculated as 12% of salary). Go to the editor

Sample table : employees


Click me to see the solution

5. Write a query to get the employee ID, names (first_name, last_name), salary in ascending order of salary. Go to the editor

Sample table : employees


Click me to see the solution

6. Write a query to get the total salaries payable to employees. Go to the editor

Sample table : employees


Click me to see the solution

7. Write a query to get the maximum and minimum salary from employees table. Go to the editor

Sample table : employees


Click me to see the solution

8. Write a query to get the average salary and number of employees in the employees table. Go to the editor

Sample table : employees


Click me to see the solution

9. Write a query to get the number of employees working with the company. Go to the editor

Sample table : employees


Click me to see the solution

10. Write a query to get the number of jobs available in the employees table. Go to the editor

Sample table : employees


Click me to see the solution

11. Write a query get all first name from employees table in upper case. Go to the editor

Sample table : employees


Click me to see the solution

12. Write a query to get the first 3 characters of first name from employees table. Go to the editor

Sample table : employees


Click me to see the solution

13. Write a query to calculate 171*214+625. Go to the editor

Click me to see the solution

14. Write a query to get the names (for example Ellen Abel, Sundar Ande etc.) of all the employees from employees table. Go to the editor

Sample table : employees


Click me to see the solution

15. Write a query to get first name from employees table after removing white spaces from both side. Go to the editor

Sample table : employees


Click me to see the solution

16. Write a query to get the length of the employee names (first_name, last_name) from employees table. Go to the editor

Sample table : employees


Click me to see the solution

17. Write a query to select first 10 records from a table. Go to the editor
Note : Assume the salary field provides the 'annual salary' information.

Sample table : employees


Click me to see the solution

18. Write a query to get monthly salary (round 2 decimal places) of each and every employee? Go to the editor

Sample table : employees


Click me to see the solution

Practice SQLite Online


Model Database

Employee Model  Database - w3resource online SQLite practice

... More

Structure of 'hr' database :

hr database