Computerworld

Structured Query Language Explained

BOSTON (05/15/2000) - The primary vehicle used for querying, reading and updating relational databases is a language called Structured Query Language, or SQL (generally pronounced sequel). Designed for asking questions about information in a database, SQL isn't a procedural language like traditional choices such as Fortran, Basic, C or Cobol, in which you write a procedure that performs one operation after another in a predefined sequence until the task is done. The procedure may be linear, loop back on itself or jump to another point or procedure. In any case, the programmer specifies the order of execution.

With SQL, however, you tell the system only what you want. It's up to the database management system to analyze the query against its own structures and figure out what operations it needs to perform to retrieve the information.

SQL is so pervasive and fundamental to accomplishing any work involving a database that virtually every application or development tool today, no matter what its own interface looks like, ends up translating queries and other commands into SQL.

Thus, a visual programming tool for developing database-enabled applications may have an appealing, object-oriented graphical interface. But once the programming is done, the system will convert all the underlying database calls and commands into SQL. This simplifies the integration of front-end and back-end systems, especially in multi-tiered client/server applications. The only major exception to this rule is with object-oriented databases, whose structure and architecture may not be relational.

Relational Databases

In a relational database, data is separated into sets that are stored in one or more tables with the familiar row-and-column structure. Relational databases can quickly retrieve separate data items from different tables and return them to the user, or to an application, as a single unified collection of data called the result. Because the various items can be grouped according to specific relationships (such as the relationship of an employee's name to an employee's location or sales performance), the relational database model gives the database designer a great deal of flexibility in describing the relationships between data elements for any specific system. One further result is that the user may gain a greater understanding of the information in the database.

The SQL Story

The history of SQL begins in the 1970s at IBM Research Laboratory in San Jose, where E.F. Codd and others developed the relational database model that spawned the system known as DB2. As relational databases proliferated in the 1980s, SQL was codified for commercial information technology use. In 1986, the American National Standards Institute and International Standards Organization established the language's first standard.

During this time of rapid change and advancement, client/server networks appeared, running a new breed of application that required a new set of programming skills. Using SQL and a network connection, multiple client applications could access a central database residing on a remote server.

In the mid-1980s, Oracle Corp. and Sybase Corp. released the first DOS-based commercial relational database management systems that used SQL as their query mechanism. Microsoft Corp. quickly licensed Sybase's technology as the foundation for its Microsoft SQL Server. Most of these products have also included proprietary libraries of tools that developers can use to make client applications work with the database, as well as drivers for supporting a host of local area network hardware, providing both flexibility and scalability.

Revisions in 1989 and 1992 added fundamental data integrity control, data administration, and definition and manipulation features. Around this time, a companion specification, Open Database Connectivity (ODBC), provided a common application programming interface through which software could connect to another database system, provided it was ODBC-compliant. A few years later, a similar specification called Java Database Connectivity emerged to define how SQL statements can be mapped to Java programs.

The 1992 SQL specification is the most current version, although a new update, SQL3 (also known as SQL-99) has been in the works for some years. The SQL3 standards effort would significantly enhance the language, enabling it to be used with persistent, complex objects in object databases. This means that SQL3 must include generalization and specialization hierarchies, multiple inheritance, user-defined data types, triggers and assertions, support for knowledge-based systems, recursive query expressions and more.

In addition, it must be able to handle all the capabilities associated with object-oriented programming, including abstract data types, methods, inheritance, polymorphism and encapsulation.

DEFINITION

Structured Query Language (SQL) is a programming language designed to get information out of and put it into a relational database. Queries are constructed from a command language that lets you select, insert, update and locate data. SQL is both an American National Standards Institute and International Standards Organization standard, although many databases support SQL with proprietary extensions.