SQL Database Programming
The Ultimate Guide to Learning SQL Database Programming Fast!
Table Of Contents
I ntroduction
The word Database is quite intimidating for programming newbies. It conjures up images of a bunch of computers running complicated scripts and people dragging their feet as they chug on a pitcher of coffee. What a lot of people dont realize, however, is that databases are not alien concepts. The database concepts have been conceived from the need to organize huge amounts of data. It takes an observant mind to notice that databases are everywhere; theyre in your phone, your email account, your music player, etc. Theyre in every computer that needs to add, display, modify, or delete data. When you create a playlist, youre effectively creating a table. When you add songs to the playlist, youre effectively inserting rows of data into the table. It doesnt even matter whether youre using a computer or simply a paper and a pen; so long as youre grouping and categorizing data, youre more or less dealing with a database.
Web developers are aware that with the advent of faster Internet connections and dynamic web design comes a need for updated content. Its easy to attract curious visitors to a wonderfully designed website, but to attract repeat visitors, you have to have a constant stream of updated content.
While traditional website creation methods still work, it poses a lot of problems in terms of upgradability and modularity. For one thing, content providers are often not capable of coding HTML, and since their content is deeply embedded there, theyll have to hire full time Webmasters just to copy their work into the HTML code. With HTML design being constantly revamped, it becomes especially tedious to keep rewriting HTML files and almost impossible to stay on top of updated web design concepts. In short, traditional web site creation is boring, tiring, and very inefficient.
Fortunately, database-driven website creation is here to save the day. By separating website design from its content, you can easily change one without affecting the other. Instead of crudely copying content from text files to HTML files, you can create a content management system so that content providers can put their work on their websites without even touching a single line of HTML code!
Whether youre a beginner, intermediate, or advanced web or app developer, or simply a curious pedestrian interested in exploring the world of SQL, this book will give you insights on how people strive to make meaning out of a bunch of seemingly random data.
If youre still wondering whether or not this book is for you, maybe these points will help you out:
- You want to master SQL without getting bogged down in overly technical terminologies that most academic books assume you know.
- You not only want to master the semantics of SQL, but you also want to learn the best and newest practices involved.
- You want to read a book that stimulates your intellect without lulling you to sleep with dry facts and theories.
- You want to get ahead in your career but dont have time to go through long, wordy tutorials.
If you can identify with any of these statements, then go brew some coffee, sit back, relax, and do a stretch as this book takes you on a fun, educational, and fast-paced journey in the world of SQL.
This book can serve as both a reference and a walkthrough for building and managing databases using SQL, so test the code snippets for yourself to better learn the nuances and intricacies of SQL.
Thanks again for downloading this book. I hope you enjoy it!
Chapter 1: Introduction to Relational Databases
I magine looking for car keys in your friends house, with no idea where it was last placed, and with rooms having a mishmash of random, unorganized items. Itd take perhaps a few days, weeks, or even months to locate them. If your friends house had been a lot smaller, then there would have been fewer places to look and therefore less of a need to organize things.
The same goes for databases. Previously, information was limited by the miniscule amount of megabytes a hard drive could hold. With terabyte hard drives taking over regular computers, more information could be stored and consequently, more possible clutter. Furthermore, because of the availability of high speed Internet, clusters of these terabyte hard drives make untangling data a lot harder.
Databases help sort and categorize data so that information is neatly packed together. There are two types of databases often used: operational databases and analytical databases.
Operational databases are what most people are familiar with since theyre commonly used to manage, contain, and change data collected rather frequently. The types of data operational databases contain change rapidly. Real life examples of operational databases would be the list of current patients in a ward or the menu for the day in the cafeteria. Basically anything that constantly changes is managed using operational databases.
Analytical databases are used to store rarely changing data. Data stored in these databases are often static, and therefore is usually historical in nature. Real life examples of analytical databases would be attendance sheets; new names add up but are rarely modified or erased.
Whats awesome about databases is that theyre so widely used and convenient that we dont realize how relevant they are in our daily lives. For example, when you book an airplane ticket or even create playlists, youre actually accessing a database. In the case of the airplane ticket, your data is encoded by authorized personnel on software that manages the database. In the case of playlists, youre most likely using a music player that does the database management for you. This is why you dont really feel the presence of databases even though theyre everywhere. Imagine having to type SELECT * from Music WHERE... Instead of just pressing the button to add, delete, or play a song. In this chapter, were going to deconstruct and demystify databases, so that you can understand how your favorite media player stores and sorts your songs, or how airlines handle bookings.
Next page