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_names
may be one or more comma-separated table names or an expression operating on whole tables
- The
conditional_expression
will contain assertions about the values of individual columns within individual rows within 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.
Customers
all records (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: SELECT * FROM Customers WHERE Last_Name='Smith'; 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)