Introduction to SQL language
SQL is a programming language that is used to manage data stored in a relational database management system (RDBMS).
SQL pronounced as /ˈɛs kjuː ˈɛl/ or /ˈsiːkwəl/. SQL full form is Structured Query Language.
SQL has three components:
- Data Defination Language (DDL): The data definition language deals with the schema/Table/View creation and modification like, CREATE TABLE statement allows us to create a new table in the database and the ALTER TABLE statement helps in changing the structure of an existing table.
- Data Manupulation Language(DML): The data manipulation language helps to query data such as the SELECT statement and to update the data such as INSERT, UPDATE, and DELETE statements.
- Data Control Language (DDL): The data control language helps with the statements that deal with the user authorization and security such as GRANT and REVOKE statements.
SQL was first introduced in 1970.SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987.Since then, the standard has been revised multiple times to include a larger set of features. Despite the existence of standards, most SQL code requires at least some changes before being ported to different database systems.
The SQL standard formalizes SQL syntax structures and behaviors across all database products. It becomes even more important to the open source databases such as MySQL and PostgreSQL where the RDBMS are developed mainly by the communities rather than big corporations.
SQL language is further divided into several language elements.
Keywords : Keywords are words that are defined in SQL language and it could be reserved like SELECT, DATE or non-reserved like DOMAIN, KEY.
Statements : These have a persistenet impact on schema and data. It may also control transactions, sessions and connections. SQL statements also include the semicolon (“;”) as statement terminator.
Clauses : These are constituent component of Statements and Queries.
Queries : These helps in retrieving the data based on specific criteria. This is a very important element of SQL language.
Predicates: It specify conditions that can be evaluated to SQL three-valued logic (3VL) (true/false/unknown) or Boolean truth values and are used to limit the effects of statements and queries, or to change program flow.
Though ANSI and ISO is handling the standardization of SQL language however the SQL community requesting for new features and capabilities that do not exist in the SQL standard, therefore, even with the SQL standard in place, there are many SQL dialects in various database products.
The following are the most popular dialects of SQL:
- PL/SQL stands for procedural language/SQL. It is developed by Oracle for the Oracle Database.
- Transact-SQL or T-SQL is developed by Microsoft for Microsoft SQL Server.
- PL/pgSQL stands for Procedural Language/PostgreSQL that consists of SQL dialect and extensions implemented in PostgreSQL.
- MySQL has its own procedural language since version 5. It is to be noted that MySQL was acquired by Oracle.
In further SQL Tutorial, we will explain the SQL syntax structures and behaviors that are valid across the databases.