Home  |  Code Home


SQL Tutorial


INTRODUCTION

SQL is short for, Structured Query Language, is the standard language used to communicate with a relational database.

Almost all modern Relational Database Management Systems like MicroSoft SQL Server, Microsoft Access, MSDE, Oracle, DB2, Sybase, MySQL, Postgres and Informix use SQL as standard database language. Although all relational database management system(RDBMS) use SQL, they use different SQL dialects. For example MS SQL Server specific version of the SQL is called T-SQL, Oracle version of SQL is called PL/SQL, MS Access version of SQL is called JET SQL, etc.

Here we will see how to use commonly used SQL commands, which can be used in any RDBMS.

Database
A database in simple is a collection of data. Some think of a database as an organized mechanism that has the capability of storing information, through which a user can retrieve stored information in an effective and efficient manner.

Relational Database
A relational database is a database divided into logical units called tables, where tables are related to one another within the database. A relational database allows data to be broken down into logical, smaller, manageable units, allowing for easier maintenance and providing more optimal database performance according to the level of organization.

SQL Tutorial Table of Contents

SQL Tutorial

Tells what SQL is, and where and how it can be used.


USING SQL Table

SQL Database Tables are the foundation of every Relational Database Management System. Learn more about them.


USING SQL SELECT

Learn how to use the SELECT SQL statement to retrieve data from a SQL database table.


USING SQL SELECT INTO

Learn how to use the SQL SELECT INTO statement to copy data between database tables.


USING SQL DISTINCT

Learn how to use the SQL DISTINCT clause together with the SQL SELECT keyword, to return a dataset with unique entries for certain database table column.


USING SQL WHERE

The SQL WHERE command is used to specify selection criteria, thus restricting the result of a SQL query.


USING SQL LIKE

The SQL LIKE clause is used along with the SQL WHERE clause and specifies criteria based on a string pattern.


USING SQL INSERT INTO

Learn how to use the SQL INSERT INTO clause to insert data into a SQL database table.


USING SQL UPDATE

Learn how to use the SQL UPDATE statement to update data in a SQL database table.


USING SQL DELETE

Learn how to use the SQL DELETE statement to delete data from a SQL database table.


USING SQL ORDER BY

Learn how to use the SQL ORDER BY statement to sort the data retrieved in your SQL query.


USING SQL IN

The SQL IN clause allows you to specify discrete values in your SQL WHERE search criteria.


USING SQL BETWEEN

The SQL BETWEEN & AND keywords define a range of data between 2 values.


USING SQL Aliases

SQL aliases can be used with database tables and/or with database table columns, depending on task you are performing.


USING SQL COUNT

The SQL COUNT aggregate function is used to count the number of rows in a database table.


USING SQL MAX

The SQL MAX aggregate function allows us to select the highest (maximum) value for a certain column.


USING SQL MIN

The SQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column.


USING SQL AVG

The SQL AVG aggregate function selects the average value for a certain table column.


USING SQL SUM

The SQL SUM aggregate function allows selecting the total for a numeric column.


USING SQL GROUP BY CLAUSE

The SQL GROUP BY statement is used along with the SQL aggregate functions like SUM to provide means of grouping the result dataset by certain database table column(s).


USING SQL HAVING CLAUSE

The SQL HAVING clause is used to restrict conditionally the output of a SQL statement, by a SQL aggregate function used in your SELECT list of columns.


USING SQL JOIN CLAUSE

The SQL JOIN clause is used whenever we have to select data from 2 or more tables.