SQL Reference & Tutorial

This section details information about Structured Query Language (SQL). SQL is generic to most true relational database management systems (RDBMS's) and is an ANSI standard. I have tried to keep the SQL examples as generic as possible and much of this information applies to any SQL RDBMS but some of this information is for an Oracle environment .

SQL is the language used to access the data and structures within a relational database. PL/SQL (an Oracle specific SQL extension) allows basic program logic and control flow to be implemented around SQL statements. Most RDBMS vendors have a similar set of extensions or allow SQL statements to be embedded within a normal development package such as Visual Basic or C++. PL/SQL is covered elsewhere on this site.

SQL Features

1.  It is meant to be an English like language using set English phrases to manipulate the database. How well it achieves this is questionable.

2.  It is non procedural. You specify the information required not the navigation and operations required to access the data. Each RDBMS has an inbuilt query optimiser which parses your SQL statements and works out the optimum path to the required data.

3.  When you query data, all the rows affected by your statement are dealt with in one go as a set, they are not dealt with separately. The work area that holds the set is known as a CURSOR.
4. SQL encompasses a range of uses and users. DBA's, application programmers, management and end users can use SQL.

5.  It provides commands for the following tasks :-

* querying data
* inserting, updating and deleting data
* creating, modifying and deleting database objects
* controlling access to the database and database objects
* guaranteeing database consistency
* monitoring database performance and configuration

Standard SQL statements can be subdivided into 4 distinct groups which are shown below. Click on a group to view information and examples on those statements.
Remember to look at the example data tables here first (or print them out for convenience).


<><><><><><><><><> <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>  <><><><><><><><><>  <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>  <><><><><><><><><>  <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>  <><><><><><><><><>  <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><>   <><><><><><><><><> 

 
Group

 

 
Statements

 

 
Description

 

 

 

 

 
SELECT

 

 
DATA QUERY LANGUAGE :

  Used to get data from the database and impose ordering upon it. 
 

 

 
  
 
DELETE
  INSERT
  UPDATE 

 
  DATA MANIPULATION LANGUAGE :
 
Used to change database data.

 

 


 
DROP   TRUNCATE
CREATE
ALTER

 
    DATA DEFINITION LANGUAGE :
  
 
Used to manipulate database structures and definitions. 

 

 

 

 

 
REVOKE
  GRANT

 
 
 
Used to give and take access rights to database objects. 

 

No comments:

Post a Comment