Monday, February 11, 2013

SQL - Why use it?

I think Tom Ben-David and John Scanlon hit the nail on the head when they described SQL as a language that can not be used standalone, but many times is used to supplement another language. If you think of how you might try and store data without a language such as SQL, you would have a hard time.

I have the luxury of having worked with SQL in the form of mySQL and PHP while designing websites. Before I was ready to use mySQL however, I used the alternatives in web design, which when you broke it down was just storing information in a text file that used semi-colons and tabs to separate the data. This is called a flat file database. It worked, and was useful for what I needed at the time, and stored data in a tabular form that I could access later. However querying in a flat file database is really just going through each entry and looking for parameters that match what you are looking for. Needless to say, the use of a flat file database did not last long into my "web design career".

mySQL (and SQL) works by creating a table that has labeled columns. A database is really just a collection of tables that can be used to connect and talk with each other using identification tags or other useful naming parameters. When you start talking about SQL databases, it sounds a little scary. However, when you break it down, the databases and tables are really just glorified excel files. The usefulness in theses tables however, is that they can be queried (searched) to find only the useful data at a time. This type of operation is extremely useful for the storage of large amounts of data. Facebook uses the same type of PHP and mySQL architecture that I am talking about, and if you consider the amount of data that must be stored on Facebook's website you may start to get overwhelmed. But to think of the database, just go to your profile, you want only information about yourself. If this information were stored in an excel file, it may take a while for you to search the excel file (even if it was a well filtered file) to find only the information about you. However, using mySQL, this operation is done neat and quickly by querying the database for only your information.

1 comment:

  1. David before reading your post I was totally oblivious to what SQL was but after reading your blog I was able to some basic knowledge of what SQL is and its purpose. The simplicity of the explanation and using examples of excel with operations of Facebook which are wildly used by the common public such as me helped better understand what you were trying to get across.

    ReplyDelete