What is a database? Well, it simply is a collection of data. How many of you are old enough to remember card catalogs in libraries? I know I am, but I am getting up there. How many of you have mothers? A few, I am guessing. How many of those mothers have recipe cards in a box or cookbooks on a shelf? Those are all databases, in essence. The IT version of a database is a little more complicated and can house shit tons of data. Every store, restaurant, gas station and school you have seen or been in, apart from some little mom and pop shops that are relics from a by-gone era, have databases that store information about the items they sell, the customers that buy them, the employees that work, etc.
Let's go back to the card catalog for a moment. A card catalog is a wooden dresser with lots of little drawers. Each drawer is filled with lots of little cards. Each card is filled with information about a book. Likewise, a database is filled with tables (drawers) and each table is filled with records (cards) and each record is filled with information about a specific thing (book). The way to get the information out of the card catalog is largely manual, although modern libraries have a computerized version of this that simplifies it a bit. You still have to get a piece of paper, jot down the Dewey Decimal number which is the location of the book and then walk around and find it. In a database, the method of retrieval is a bit different. Which brings us to our second question...
What is SQL? SQL or Structured Query Language is a method of inserting, modifying, or retrieving information from IT databases. ANSI-SQL is the industry-wide agreed upon terminology and methodology for interacting with data in a database. Each company has to make slight additions or change implementations a bit to provide value and/or differentiate themselves from the competition but the core is the same across all brands.
There are several different ways of getting data into a database and modifying data in a database, but the bread and butter of SQL is the SELECT statement. Let's say you are an IT guy and you built a recipe database for dear old mom. There will be a period of time where you, she or the whole family enters the data into the database. Afterwards, when mom wants to bake a cake, she will write a select statement. Now, depending on how advanced of an IT guy you are or how much you love your mother, you may mask the select statement behind a search box on a web page but the underlying mechanism is a SELECT. That statement might look like this:
SELECT * FROM Recipes WHERE recipe_type = 'CAKE';
This would return every record in the Recipes table that is for a cake. Simple, right? Sure, for Mom's Recipes, yeah, it is simple. Now think about a store like Home Depot? What might their database look like? What might a SELECT statement look like there? Well, it can get pretty complicated. What if your database was designed by a drunken water-head with extra chromosomes, parents that are cousins and no idea what a good database looks like? Queries in this behemoth make modern politics look sane and straightforward. I can only surmise that our DB architects mother was a willing participant because as we all know, if it was a legitimate rape, her body would have "shut that whole thing down". What a whore. I blame her for everything. With all the drinking she must have done in those nine months, I can't believe it went full term. It kind of makes me wish for a time traveling retroactive sterilization program that could nip that shit in the bud. The downside of that is, I'm pretty sure my Ex-wife would partake of that and my blogs would go poof into nonexistence. But, I digress.
SQL can be simple and can be very complex. But if it were always easy, everyone would do it, you know, like your mom.
Well, there you have it. Another installment from the angry database dude. I had so hoped I would avoid the anger and do a legitimate post, but people are stupid and they piss me off and my anger shut that whole legit thing down. Eh, maybe next time. And, as John Henson always says, Good night and big balls.
No comments:
Post a Comment