SQL Exercises, Practice, Solution
What is SQL?
SQL stands for Structured Query Language and it is an ANSI standard computer language for accessing and manipulating database systems. It is used for managing data in relational database management system which stores data in the form of tables and relationship between data is also stored in the form of tables. SQL statements are used to retrieve and update data in a database.
The best way we learn anything is by practice and exercise questions. We have started this section for those (beginner to intermediate) who are familiar with SQL. Hope, these exercises help you to improve your SQL skills. Currently following sections are available, we are working hard to add more exercises. Happy Coding!
You may read our SQL tutorial before solving the following exercises.
List of SQL Exercises
- SQL Retrieve data from tables [33 Exercises]
- SQL Boolean and Relational operators [12 Exercises]
- SQL Wildcard and Special operators [22 Exercises]
- SQL Aggregate Functions [25 Exercises]
- SQL Formatting query output [10 Exercises]
- SQL Quering on Multiple Tables [8 Exercises]
- FILTERING and SORTING on HR Database [38 Exercises]
- SQL JOINS
- SQL SUBQUERIES
- SQL Union[9 Exercises]
- SQL View[16 Exercises]
- SQL User Account Management [16 Exercise]
- Movie Database
- BASIC queries on movie Database [10 Exercises]
- SUBQUERIES on movie Database [16 Exercises]
- JOINS on movie Database [24 Exercises]
- Soccer Database
- BASIC queries on soccer Database [29 Exercises]
- SUBQUERIES on soccer Database [33 Exercises]
- Hospital Database
- Employee Database
- AdventureWorks Database:
- SQL Challenges-1:
- More to come!
Structure of inventory database :
Structure of HR database :
Structure of movie database :
Structure of soccer database :
Structure of employee database :
Structure of hospital database :
Syntax diagram of SQL SELECT statement
You may download the structure and data of the tables of database on which SQL Exercises are built.
Please note that PostgreSQL 9.4 is used and the file which you would download is generated using pg_dump
SQL: Tips of the Day
What is the difference between HAVING and WHERE in SQL?
HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.
Ref : https://bit.ly/3f9ZwrA
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises