SQL Intro

  
Introduction

In June 1970 Dr. E. F. Codd published the paper, "A Relational Model of Data for Large Shared Data Banks" in the Association of Computer Machinery (ACM) journal. Codd's model is now accepted as the definitive model for relational database management systems (RDBMS).

Using Codd's model the language, Structured English Query Language (SEQUEL) was developed by IBM Corporation in San Jose Research Center. The language was first called SEQUEL but Official pronunciation of SQL is ESS QUE ELL.

In 1979 Oracle introduced the first commercially available implementation of SQL. Later other players join in the race. Today, SQL is accepted as the standard RDBMS language.

What is SQL?

SQL stands for Structured Query Language and it is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. It is used for managing data in relational database management system which stores data in the form of tables and relationship between data is also stored in the form of tables. SQL statements are used to retrieve and update data in a database.

SQL works with database programs like DB2, MySQL, PostgreSQL, Oracle, SQLite, SQL Server, Sybase, MS Access and much more. There are many different versions of the SQL language, but to be in compliance with the ANSI standard, they support the major keyword such as SELECT, UPDATE, DELETE, INSERT, WHERE, and others. The following picture shows the communicating with an RDBMS using SQL.


History of SQL

·        1970 E.F. Codd publishes Definition of Relational Model
·        1975 Initial version of SQL Implemented (D. Chamberlin)
·        IBM experimental version: System R (1977) w/revised SQL
·        IBM commercial versions: SQL/DS and DB2 (the early 1980s)
·        Oracle introduces commercial version before IBM's SQL/DS
·        INGRES 1981 & 85
·        ShareBase 1982 & 86
·        Data General (1984)
·        Sybase (1986)
·        by 1992 over 100 SQL products


SQL Standard Revisions
·        SEQUEL/Original SQL - 1974
·        SQL/86 - Ratification and acceptance of a formal SQL standard by ANSI (American National Standards Institute) and ISO (International Standards Organization).
·        SQL/92 - Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
·        SQL/99 - Added regular expression matching, recursive queries (e.g. transitive closure), triggers, support for procedural and control-of-flow statements, non-scalar types, and some object-oriented features (e.g. structured types).
·        SQL/2003 - Introduced XML-related features (SQL/XML), Window functions, Auto generation.
·        SQL/2006 - Lots of XML Support for XQuery, an XML-SQL interface standard.
·        SQL/2008 - Adds INSTEAD OF triggers, TRUNCATE statement.


Constructs of SQL
Here is list of the key elements of SQL along with a brief description:
·        Queries : Retrieves data against some criteria.
·        Statements : Controls transactions, program flow, connections, sessions, or diagnostics.
·        Clauses : Components of Queries and Statements.
·        Expressions : Combination of symbols and operators and a key part of the SQL statements.
·        Predicates : Specifies conditions.


Some Key terms of SQL 2003
To know the key terms of SQL 2003, you should know the statement classes of both SQL 92 AND SQL 2003, since both are used to refer SQL features and statements.

In SQL 92, SQL statements are grouped into following categories:

Data manipulation : The Data Manipulation Language (DML) is the subset of SQL which is used to add, update and delete data.

 Data definition : The Data Definition Language (DDL) is used to manage table and index structure. CREATE, ALTER, RENAME, DROP and TRUNCATE statements are to name a few data definition elements.

Data control : The Data Control Language (DCL) is used to set permissions to users and groups of users whether they can access and manipulate data.

Transaction : A transaction contains a number of SQL statements. After the transaction begins, all of the SQL statements are executed and at the end of the transaction, permanent changes are made in the associated tables.

Procedure : Using a stored procedure, a method is created which contains source code for performing repetitive tasks.