DATABASE QUERY LANGUAGE

Database systems are useful, but what makes them powerful is the ability to retrieve information out of them in an organized manner. Most modern database systems (products such as Oracle, mySQL, or Microsoft SQL Server) can process a special type of language, called a query language . You use these languages to query the database, or ask it to return information.

Using query languages, you write instructions called queries to return the exact information you need. Exactly how these queries are created and used in your program depends on the facilities in the language you are using. Rather than get into programming language specific issues I am going to emphasis the query language itself.

The most common query language today is called SQL (Structured Query Language). It's usually pronounced sequel, although an earlier, much older query language was actually named SEQUEL, and there are a few people who claim that pronunciation causes confusion.

Most modern database systems process a version of SQL. Unfortunately, it's not as well standardized as are programming languages. Manufacturers are always trying to distinguish their product so they keep adding functions. Nevertheless, the basics of the language that are discussed here are pretty standard.

Using SQL, you can retrieve specific information from a table, such as the zip code for everyone in the address table whose first name is Judy. You can also perform queries that are more complicated. For example, you can have your query return the name, street address, city, state, and Zip Code from the address table for every name in the flyer mailing table whose last mailing date is older than two weeks ago. In this case, your query would match the names between the two tables to find the address for the names it identifies in the flyer mailing table.

The ability to match up data from different tables in this manner is what distinguishes a relational database from a flat database. Pieces of data such as the name in the previous example can be used to identify other data based on its relationship to it, in different tables. SQL accommodates flexible logic in matching information such as this. The following section looks at the four basic operations SQL can perform.