The Structured Query Language (SQL) is the computer language in which a user or an application communicates with an SQL-capable database system. SQL database systems include PostgreSQL, MySQL, Oracle, and many others in popular use.
The language is standardized by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO), but many database systems provide their own extensions to the standard or do not fully implement the standard. These extensions typically extend SQL functionality into an altogether different programming language or markup language.
SQL was first developed in the early 1970s for use with System R, a database system created by IBM.
Most database systems use a client-server model to facilitate interaction between an application and the database. The server is essentially a “front end” to the database, which interprets SQL and directs the database to perform certain operations.
The client can be anything from a relatively simple command line program like PostgreSQL’s psql to a web site or a complex software application that manages something like government personnel and technology infrastructure.
The client usually sends SQL instructions to the server via a network socket, if the database server is running on another computer or is running Microsoft Windows. If the client and the server are both running on UNIX or a UNIX-like operating system, they may communicate via a UNIX socket.
Due to the strictly local nature of a UNIX socket, it generally provides a much more secure method for database access. Some database systems provide facilities for secure, encrypted access over a network.
When the server receives the SQL instructions from the client, it performs the requested action on the database and returns a result to the client. The result can be as simple as a statement meaning “OK, that worked” or as complicated as a million-line set of data that was retrieved from the database.
SQL is composed of a number of different elements: queries, statements, expressions, predicates, and clauses. By far, the most commonly used of these elements is the query. Of particular note in SQL syntax are two symbols, the asterisk (“*”), which is a wildcard that means “everything”, and the semicolon (“;”), which is always used at the end of a command. The semicolon terminator is not required on all SQL platforms.
Next Page: SQL Queries