This tutorial illustrates the essential concepts of the SQL language in a easy to understand, well organized manner. This SQL tutorial provides comprehensive coverage of different topics, starting from basic SELECT statements and filtering rows, to sorting a result set, querying multiple tables, using various functions and creating new database structures.

 

In order to help you better understand different topics, most of these tutorials are accompanied by exercises (including solutions), allowing you to practice the SQL Language. To download the databases used in these exercises, use one of the following links: [ACDB] [HR]

 

Please note – this SQL tutorial focuses on Oracle environment. If you want to learn SQL on a different platform, please use this link

Basic SELECT Statement

Exercises ACDB | Exercises HR 

The Oracle SELECT clause is used to query the database and retrieve selected rows. This guide explains the basic concepts of the Oracle SELECT statement, how to perform arithmetic operations, how to rename a column’s header using Column Aliases, how to concatenate string values, and how to fetch unique records using the Oracle DISTINCT keyword.

Filtering and Sorting the Results

Exercises ACDB | Exercises HR 

The Oracle WHERE clause is used to filter the number of rows returned by a SQL query, allowing you to retrieve specific information excluding irrelevant data. This tutorial explains how to use different Oracle Comparison Operators in order to get records that meet specific criteria. This tutorial also explains how to to sort the result set using the Oracle ORDER BY clause.

Scalar Functions 

Exercises ACDB | Exercises HR 

Scalar Functions are used to carry out operations such as: mathematical tasks on numerical data, different manipulations on string and dates values, NULL-related operations, and datatypes conversions. This guide provides you a summary of some of the most common Oracle Built-in Scalar Functions

Group Functions

Exercises ACDB | Exercises HR

Oracle Group functions are SQL functions that operate on groups of records, and for each group return one result. This tutorial lists some of the most common Oracle Group Functions, this tutorial also explains how to use the Oracle GROUP BY and the HAVING clauses.

Querying Multiple Tables

Exercises ACDB | Exercises HR 

A JOIN is a query that combine information from two or more tables, in Oracle there are different types of JOIN, used to achieve different goals. This tutorial explains the following JOIN types: Inner Join, Outer Join and Self Join.

Sub Queries

Exercises ACDB | Exercises HR 

A subquery in Oracle is used to run a separate query from within the main query, in many cases the returned value is used as a filter condition in a WHERE or a HAVING clause. This tutorial explains how to nest a query within another query in order to further restrict the data to be retrieved. This tutorial also describes the difference between two common types of subqueries: single-row and multiple-row.

DML

DML (Data Manipulation Language) statements are used to modify information in a table in one of the three ways: INSERT – Adding new rows to a table. UPDATE – Modifies the data of a table, DELETE – Deletes one or more rows from a table. This tutorial demonstrates how to use these statements, explains how to use the MERGE statement, and briefly describes database transactions.

DDL

DDL (Data Definition Language) statements are used to create and alter database objects. This tutorial explains how to create a new table using the Oracle CREATE TABLE statement, how to modify the structure of existing table using the ALTER statement, and how to remove a table from the database using the DROP statement.