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 StockNumberIt’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.
FROM Prices
WHERE Price > 5
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:SELECT Price
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:
- Retrieving data with the SELECT command
- Adding data with the INSERT command
- Deleting data with the DELETE and TRUNCATE commands
- Creating new tables with the CREATE command
- Removing tables with the DROP command
- Combining tables with the JOIN command
- Using TRY…CATCH to Handle SQL Server Errors
- Classifying Results with SQL CASE Statements

