The end of last week and today were spent learning about databases (relational databases mostly). I was stoked to get started on the databases sections because I’ve been wanting to actually use SQL forever. The tutorial was seriously just a fly by and nothing more. I could have spent hours and hours working through ALL of the tutorials on Khan Academy or other sites, but The Odin Project promises that I’ll get a heavy dose in the subsequent tracks.
Now, for a quick intro and brain dump on databases. When people say the word database or even think about it there is this instant “nah uh, back away” type of behavior. When in reality it’s a fairly simple concept. Data is honestly just stored just like you see it in an Excel spreadsheet (or flat two dimensional table). A relational database takes this one step further and provides connections between tables to model the relations. This is all done with SQL (Structured Query Language). Where things start to get tricky are in enterprise level systems that have hundreds of thousands of tables that form relations (think Amazon or Facebook). Here is a quick example of a very very basic relational database (stolen from this awesome e-book for simplicity and speed).
Movies
| mID | Title | Year | Director |
|---|---|---|---|
| 101 | Top Gun | 1986 | Tony Scott |
| 102 | Titanic | 1997 | James Cameron |
| 103 | The Lion King | 1994 | Rob Minkoff |
| 104 | Gravity | 2013 | Alfonso Cuaron |
| 105 | Harry Potter | 2001 | <null> |
| 106 | Cast Away | 2000 | Robert Zemeckis |
| 107 | Spider Man | 2002 | Sam Raimi |
| 108 | The Godfather | 1972 | Francis Coppola |
User
| uID | Name |
|---|---|
| 201 | James Dean |
| 202 | Chris Anderson |
| 203 | Ashley Burley |
| 204 | Ralph Truman |
| 205 | Gordon Maximus |
| 206 | Sarah Rodgriguez |
| 207 | Darrel Sherman |
| 208 | Lisa Jackson |
Review
| uID | mID | Rating | ratingDate |
|---|---|---|---|
| 201 | 101 | 2 | 2014-03-09 |
| 201 | 101 | 4 | 2014-03-02 |
| 202 | 104 | 4 | <null> |
| 203 | 107 | 2 | 2014-03-24 |
| 204 | 103 | 4 | 2014-03-17 |
| 204 | 104 | 2 | 2014-03-13 |
| 205 | 108 | 3 | 2014-03-24 |
| 206 | 102 | 3 | 2014-03-02 |
| 207 | 104 | 5 | <null> |
| 207 | 106 | 4 | 2014-03-07 |
| 207 | 102 | 5 | 2014-03-26 |
| 208 | 105 | 2 | 2014-03-13 |
This stuff honestly gets me so excited. It’s at the heart of pretty much any major website or platform that you use and might be where I specialize in the long run (if I don’t get addicted to Machine Learning or that sorta cool self-driving car technology). In any case, that’s a basic overview of a relational database.
Interacting with a database is all done using SQL (I pronounce it Si-Kwel), which really isn’t that complex of a language. Check it out below:
SELECT Title, Year
FROM Movie
WHERE Year > 2000;
This is the basic syntax to pull the title and year of a movie, where the year is greater than 2000. Pretty neat huh? One more quick example:
SELECT Movie.mID, Title, Rating
FROM Movie, Review
WHERE Movie.mID = Review.mID
and Rating > 2 and Year < 2000;
Selects movie by movie ID, Title, Rating from two tables (Movie, Review), match the movie ID’s and Review ID’s and then get the movies that have ratings > 2 and were released before the year 2000. These are all basic SELECT statements, which don’t even touch upon the rest of CRUD (Create, Read, Update, Delete). This is all a part of the Read section of CRUD. I’m sure I’ll get to the Update and Delete portions of SQL later on. That’s really all there was to the introduction (as I said very light). We’ll see how much further I get to go when I really do a deep dive. I might even start on my own if I’m motivated enough or have the free time.
Work has been going really well so far. There really hasn’t been any down time and I’m learning a ton about how mid-sized firms truly run their IT teams. My first two projects are to handle a fair chunk of the documentation that hasn’t been completed before (using Fresh Service) and starting my first true project management schedule / timeline for the creation of Telephony-As-A-Service. The goal is to get to the point where the IT Support team (NOT Infrastructure or Applications) is handling all of the setup and maintenance of the telephony service. Essentially all customers (internal employees) will be able to come to the vendor (IT) and make requests. The service documentation will be able to quickly show the cost of such request along with SLAs for maintenance turn around. I’ve got until next Wednesday to put together the timeline so it’ll be a bit of a crunch to get it done. Super stoked to present it to the CIO though. I’ll update on that front as I move forward.
Lastly, I’m trying to figure out how I can squeeze in more time coding, but it’s been hard. We’ll see if I can start getting to bed earlier to get an hour in before work. It all comes down to hours at this point! Either way, stoked to get an intro to databases and work is going really well. I’ll be back soon. Cheers!