Comparing SQL To Other Programming Languages
Comparing SQL To Other Programming Languages
Now that you know what SQL can be used for, you can compare it to other programming languages. To
be honest, SQL is quite different from the procedural languages such as C++, Visual Basic, Pascal, and
other third-generation programming languages, which allow the programmer to write step-by-step
instructions telling the computer exactly what to do to achieve a specified goal. Taking the car sales
example, your goal might be to select all the information about sales made in July from the New York car
showroom. Very roughly, your procedural language might be along the lines of the following:
1. Load the sales data into the computers memory.
2. Extract the individual items of data from the sales data.
3. Check to see if each item of data is from the month of July and from the New York showroom.
4. If it is, then make a note of the data.
5. Go to the next item of data and keep going until all items have been checked.
6. Loop through the data results and display each one.
SQL, however, is a declarative language, which means that instead of telling it what to do to get the
results you want, you simply tell it what you want, and it figures out what to do and comes back with
the results. In the car sales example, if you were using SQL, youd specify the results you want, something
like this:
SELECT all the data from the sales table WHERE the sales were in July and made at the New York
showroom.
12