1. Computing
Send to a Friend via Email

Discuss in my forum

Introduction to SQL


The Structured Query Language (SQL) is the language of databases. All modern relational databases, including Access, FileMaker Pro, Microsoft SQL Server and Oracle use SQL as their basic building block. In fact, it’s often the only way that you can truly interact with the database itself. All of the fancy graphical user interfaces that provide data entry and manipulation functionality are nothing more than SQL translators. They take the actions you perform graphically and convert them to SQL commands understood by the database.

SQL is Similar to English

At this point, you might be thinking that you’re not a programmer and learning a programming language is certainly not up your alley. Fortunately, at its core, SQL is a simple language. It has a limited number of commands and those commands are very readable and are almost structured like English sentences.

Introducing Databases

Before we get started, it’s important that you have a basic understanding of how databases work. If you’re comfortable with terms like table, relation and query, feel free to plow right ahead! If not, you may wish to read the article Database Fundamentals before moving on.

Let’s look at an example. Suppose you have a simple database designed to keep the inventory for a convenience store. One of the tables in your database might contain the prices of the items on your shelves indexed by unique stock numbers that identify each item. You’d probably give that table a simple name like “Prices.” If you were considering removing items from your store that were priced over $5, you might want to retrieve this information from your database.

Your First SQL Query

Before we get into the SQL statement required to retrieve this information, let’s try phrasing our question in plain English. We want to “select all stock numbers from the prices table where the price is over $5.” That’s a pretty simple request when expressed in plain English, and it’s almost as simple in SQL! Here’s the corresponding SQL statement:
SELECT StockNumber
FROM Prices
WHERE Price > 5
It’s as simple as that! If you read the statement above out loud, you’ll find that it’s extremely similar to the English question we posed in the last paragraph.

Interpreting SQL Statements

Now let’s try another example. This time, however, we’ll do it backwards. First, I’ll provide you with the SQL statement and let’s see if you can explain it in plain English:

FROM Prices
WHERE StockNumber = 3006

So, what do you think this statement does? That’s right, it retrieves the price from the database for item 3006.

There’s one simple lesson you should take away from our discussion at this point: SQL is like English. Don’t worry about how you construct SQL statements; we’ll get to that in the rest of our series. Just realize that SQL isn’t as intimidating as it may first appear.

Now that you're familiar with the basics of SQL, read the following articles to get some more advanced training:

Learning More

If you would like to learn more about the Structured Query Language, sign up for our free Learning SQL e-mail course.
Related Video
Export Data From an Excel Sheet to a Word Document
  1. About.com
  2. Computing
  3. Databases
  4. Learning SQL
  5. Basic SQL Tutorials
  6. Introduction to SQL

©2014 About.com. All rights reserved.