SQL Tutorial

next


SQL is short for Structured Query Language and is a widely used database language, providing means of data manipulation (store, retrieve, update, delete) and database creation.

Almost all modern Relational Database Management Systems like MySQL, Oracle, MS SQL Server, Microsoft Access, MSDE, DB2, Sybase, Postgres, and Informix use SQL as standard database language. Now a word of warning here, although all those RDBMS use SQL, they use different SQL dialects.

Our SQL tutorial will teach you how to use commonly used SQL commands and you will be able to apply most of the knowledge gathered from this SQL tutorial to any of the databases above.

Table of Contents

Introduction to SQL
  SQL is a standard computer language for accessing and manipulating databases.

 

SQL SELECT Statement
  The SELECT statement is used to select data from a table. The tabular result is stored in a result table (called the result-set).

 

SQL WHERE Clause
  The WHERE clause is used to specify a selection criterion.

 

SQL INSERT INTO Statement
  The INSERT INTO statement is used to insert new rows into a table.

 

SQL UPDATE Statement
  The UPDATE statement is used to modify the data in a table.

 

SQL DELETE Statement
  The DELETE statement is used to delete rows in a table.

 

SQL ORDER BY
  The ORDER BY keyword is used to sort the result.

 

SQL AND & OR
  AND and OR join two or more conditions in a WHERE clause.

 

SQL IN
  The IN operator may be used if you know the exact value you want to return for at least one of the columns.

 

SQL BETWEEN
  The BETWEEN ... AND operator selects a range of data between two values. These values can be numbers, text, or dates.

 

SQL Alias
  With SQL, aliases can be used for column names and table names.

 

SQL JOIN
  Sometimes we have to select data from two or more tables to make our result complete. We have to perform a join.

 

SQL UNION and UNION ALL
  The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.

 

SQL Create Database, Table, and Index
  Learn how to create Databases, Tables, and Indexes.

 

SQL Drop Index, Table and Database
  Learn how to delete Indexes, Tables, and Databases.

 

SQL ALTER TABLE
  The ALTER TABLE statement is used to add or drop columns in an existing table.

 

SQL Functions
  SQL has a lot of built-in functions for counting and calculations.

 

SQL GROUP BY and HAVING
  Aggregate functions (like SUM) often need an added GROUP BY functionality.

 

SQL SELECT INTO Statement
  The SELECT INTO statement is most often used to create backup copies of tables or for archiving records.

 

SQL CREATE VIEW Statement
  A view is a virtual table based on the result-set of a SELECT statement.

 

SQL Servers - RDBMS
  Modern SQL Servers are built on RDBMS.

 

SQL Quick Reference
  SQL Quick Reference. Print it, and fold it in your pocket.

 


next