SQL Scripts

Coding SQL scripts is actually quite an easy task.  The scripts are really just simple statements.  If you have done any form of coding before you can really get this quickly.  In the examples I have provided below I have used Microsoft SQL Express because it was free for a download and it is easy for people to begin with.  You could also use Oracle or my favorite MYSQL but it is not for usually used in a Microsoft Windows environment.

Step 1: Create the Database

Step 2: Create the Tables

Step 3: Create the Data

Step 4: Query the Database

After you have some form of database installed you will have to get into the SQL Query engine to run the scripts.  Before you can start you first have to create a database.  An easy analogy of the whole database creation process is to think of it as building a house.  As with all construction you must first build a foundation.  The creation of the actual database (like the script below) will create a database (actually two databases in my example) or a foundation from which we can build the house.  Running the scripts for the most part is a simple cut and past.

After creating the database you now have to create the tables.  Going back to the construction theme here is where we actually construct the rooms of the building.  The rooms would be synonymous with the tables themselves as each table would be like a separate room built on the foundation (database).

Now the Database and the tables have been created it is now time to create the data.  In my building analogy this is where we put things like furniture and other items in the rooms of the house that was built.  

Finally there is the querying of the data.  This can be as easy or as complicated as you want to make it but I have included the simple queries in my example.  Going back to the construction theme this would be representative of looking for your car keys in the home you had just built as we are searching the specific building foundation (database) and looking in all the rooms (tables) for the car keys (data).  :)