Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

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_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 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:

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)

Following is an SQL command that displays only two columns, column_name_1 and column_name_3, from the table myTable:

SELECT column_name_1, column_name_3 from 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":

SELECT * from column_name_3 where column_name_3 like '%brain%'
This is document ahux in domain all.
Last modified on March 24, 2011.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.