What Is SQL & What It Does

Structured Query Language (abbreviated SQL, pronounced to rhyme with equal) is a computer language for communication with databases. The communicating parties are typically a front-end which sends a SQL Statement across a connection to a back-end that holds the data.

What Is SQL

The above-mentioned statement contains instructions to create, read, change or delete data. The universal rules of the language have been established by ANSI (American National Standards Institute), a standards committee composed of database experts from industry, academia and software vendors. Therefore, the SQL language is open, meaning it is not owned or controlled by any single company.

  • SQL is a non-proprietary (open) language whose rules have been set by a standards committee.

  • The strength of SQL is its universal acceptance by database vendors.

  • By learning SQL we have a language that can be used in Visual Basic or C++ to talk to an Oracle database.

  • We can use SQL in an ASP page to talk to Microsoft SQL Server.

  • We can send a request for data from IBM’s DB2 to a Sybase datastore.

  • Furthermore, we can even use SQL within Access to describe the items we want to include in a form’s list box.

  • There has been a lot of talk and marketing about “write once, run anywhere” languages like Java.

  • For database programmers, understanding SQL is the ticket to learn once, profit anywhere.

What It Does

SQL has many capabilities, but the most common needs in business are to

  • Read existing data

  • Create new records holding data

  • Change existing data

  • Delete data

SQL contains keywords or parts to perform these basic tasks. But before we begin to look at the syntax and lists of common mistakes, we’ll look at some examples of each these operations in the next few paragraphs. Reading data is the most common task.

Example

  • An ANSI-SQL statement requesting a list of names of all members of our society that live in New York can be sent from a Visual Basic application to an Oracle database.

  • If the database is later changed to IBM’s DB2, the SQL statement is still valid.

  • The SQL language offers many permutations of the request, including the ability to return the names in various orders, only the first or last few names, a list of names without duplicates and various other requests where people require specific information from their database.

Example

  • Records can be created in a datastore using SQL.

  • A form page on a web site can gather information from a visitor and then put that data into a SQL statement.

  • The SQL statement will instruct the datastore to insert a new record into a Microsoft SQL Server database.

  • Since SQL is universally accepted, the same SQL statement could, for example, be used for clerks that create new records from, say, a Visual Basic application on their local network.

Data can also be changed using SQL. As in the examples above, a front end user interface such as a web page can accept changes to data and send them via a SQL statement to the datastore. But there does not have to be direct user interaction. A DB2 database running on an IBM mainframe could have a procedure to connect to another corporate mainframe running Sybase.

The IBM can generate and send a SQL statement to modify the data in certain records in the Sybase database. Although the systems are from different vendors and have different ways of storing and using data, they both understand the SQL statement. Deleting data can be performed using SQL statements. In fact SQL can accommodate very complex sets of conditions for which records to delete and which to leave intact. Portions of data within a record can be deleted.

Read about declarative programming

Subscribe For More Content