What is SQL?
Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting information from databases. SQL is an ANSI and ISO standard, and is the de facto standard database query language. A variety of established database products support SQL, including products from Oracle and Microsoft SQL Server. It is widely used in both industry and academia, often for enormous, complex databases.
In a distributed database system, a program often referred to as the database's "back end" runs constantly on a server, interpreting data files on the server as a standard relational database. Programs on client computers allow users to manipulate that data, using tables, columns, rows, and fields. To do this, client programs send SQL statements to the server. The server then processes these statements and returns replies to the client program.
Examples
To illustrate, consider a simple SQL command, SELECT. SELECT retrieves a set of data from the database according to some criteria, using the syntax:
SELECT list_of_column_names from list_of_relation_names where conditional_expression_that_identifies_specific_rows- The
list_of_relation_namesmay be one or more comma-separated table names or an expression operating on whole tables.
- The
conditional_expressionwill contain assertions about the values of individual columns within individual rows in a table, and only those rows meeting the assertions will be selected. Conditional expressions within SQL are very similar to conditional expressions found in most programming languages.
For example, to retrieve from a table called Customers
all columns (designated by the asterisk) with a value of
Smith for the column Last_Name, a client
program would prepare and send this SQL statement to the server back
end:
The server back end may then reply with data such as this:
+---------+-----------+------------+ | Cust_No | Last_Name | First_Name | +---------+-----------+------------+ | 1001 | Smith | John | | 2039 | Smith | David | | 2098 | Smith | Matthew | +---------+-----------+------------+ 3 rows in set (0.05 sec)
Following is an SQL command that displays only two columns,
column_name_1 and column_name_3, from the
table myTable:
Below is a SELECT statement displaying all the columns of the table
myTable2 for each row whose column_name_3
value includes the string "brain":
Last modified on March 24, 2011.







