Aller au contenu principal

Introduction to SQL

What is SQL?

SQL (Structured Query Language) is the standard language used to communicate with relational databases. It is used for storing, manipulating, and retrieving data stored in relational database systems (RDBMS).

SQL allows users to create, modify, query, and manage data using a standardized syntax. It supports a wide range of operations including inserting data into tables, updating existing data, deleting records, retrieving specific data using queries, and managing database schemas.


History of SQL

  • 1970: The foundations of SQL were laid by Dr. Edgar F. Codd at IBM when he published the paper "A Relational Model of Data for Large Shared Data Banks." This paper introduced the concept of relational databases.

  • 1974: Donald D. Chamberlin and Raymond F. Boyce at IBM developed a language called SEQUEL (Structured English Query Language), which later became SQL. It was originally designed to manipulate and retrieve data stored in IBM’s experimental relational database system called System R.

  • 1979: Oracle (then Relational Software Inc.) became the first company to release a commercial implementation of SQL, preceding IBM's official release.

  • 1986: SQL was adopted as a standard by the American National Standards Institute (ANSI), and later by the International Organization for Standardization (ISO).


SQL Standards Over Time

SQL has evolved significantly since its inception. Here's a brief timeline of the major SQL standard versions:

  • SQL-86 (SQL-87): The first ANSI standard for SQL. Established the basic syntax and semantics.

  • SQL-89: Minor revision with limited new features and improved consistency.

  • SQL-92: A major update introducing a more robust set of features such as enhanced join operations, subqueries, and better compliance guidelines. Also known as SQL2.

  • SQL:1999 (SQL3): Introduced object-relational features, triggers, recursive queries (WITH RECURSIVE), user-defined types (UDTs), and procedural extensions (like BEGIN...END, loops, and conditionals).

  • SQL:2003: Introduced XML-related features, window functions (e.g., ROW_NUMBER()), and MERGE statements.

  • SQL:2006: Focused on better integration with XML, supporting SQL/XML standard queries.

  • SQL:2008: Included improvements to MERGE, TRUNCATE, FILTER clause in aggregate functions, and INSTEAD OF triggers.

  • SQL:2011: Brought significant features like temporal tables (for tracking historical data) and enhanced time-based querying.

  • SQL:2016: Introduced JSON support, row pattern matching, and POLYMORPHIC table functions.

  • SQL:2019: Expanded support for table functions, improved JSON querying, and better integration with modern applications.


Importance of SQL Standards

The ANSI and ISO standards ensure that SQL remains a consistent and interoperable language across different RDBMS implementations. However, most database systems (like PostgreSQL, MySQL, SQL Server, and Oracle) implement their own dialects of SQL that extend the standard with proprietary features.

Examples:

  • T-SQL (SQL Server)
  • PL/SQL (Oracle)
  • PL/pgSQL (PostgreSQL)

Understanding the core SQL standard while also being aware of vendor-specific extensions is crucial for writing portable and optimized SQL code.


Summary

SQL is a mature and evolving language that forms the backbone of relational data management. Learning its history and standards provides essential context for understanding why things work the way they do — and helps developers write better, more future-proof queries.

“The relational model is as revolutionary a concept as Copernicus’ idea that the Earth moves around the Sun.” — Edgar F. Codd