Advanced SQL


Suppose we have to see few of the records that are stored in the database. What do we do? We use SQL language to query the database and retrieve the required data.

SQL allows us to perform various transactions on the underlying database data. It allows the user to retrieve simple to complex request in an efficient way. The basic command used to retrieve the data from the database is SELECT.  The basic structure of SQL query is as follows:

SELECT Column/s

FROM table_name/s

WHERE Condition/s;

That means any query would select a set of columns from list of tables based on their join conditions as well as any other filter conditions. It may pick one or more columns from one or more tables. Whenever more than one table is used in the query, the basic join condition to map these two tables should be used. This will relate the two tables in the query. In addition, we can specify any number of filter conditions to get the result.

We can have various types of operations like filtering, sorting, grouping etc on the records retrieved by SELECT query. Let us see all of them in details.

Select Operation

NULL Values



Join Operation

Sub Queries

Correlated Sub Queries

Other Operations

Conditional Control

Case Statement


Translate ┬╗