Wed, 25 June 2014
The SQL Subquery
So, what is a subquery?
First and foremost, let’s get the jargon out of the way. A subquery can also be referred to as a nested query. It’s just like having a nested
What’s very important to note here is that the SQL subquery can almost always be re-written as a
More info on this via http://howtoprogramwithjava.com/session49
Mon, 16 June 2014
After having talked about all the SQL Aggregate functions, there’s one more topic that goes hand in hand with what we’ve already learned… The
This particular keyword allows us to take a bunch of data and mash it all together into matching groups and then perform aggregate functions on those groups (like
You might ask yourself why you’d want to “mash together” a bunch of data. The answer to this is best explained with an example, but let me try to put it in regular words before we jump into our example. Grouping data together allows us to look at aggregate data in relation to unique piece of data (or rows), a typical use case would be to group all the matching data together so you can get a count of the number of occurrences of specific data. An example related to grouping and counting could be a presidential election, you’ll have all the votes in a database and you’ll want to group that data together to get the total votes for each unique candidate...
For more info, check out the show notes via http://howtoprogramwithjava.com/session48
Thu, 5 June 2014
In today’s podcast episode you’ll be learning all about the aggregate functions that exist in SQL.
What the heck is an aggregate function? Well that’s what I’m going to try and teach you today, and I promise, it’s not a difficult concept to grasp. Just think of an aggregate function as a method that you’re calling that will process data in your database and return a value. Obviously the returned value will depend on which of the aggregate functions you choose to use.
So that begs an obvious question, what are the aggregate functions that we can use in SQL? I’m glad you asked, here’s the ones that I use all the time in MySQL:
Okay, great! So now we know what the names of these functions are, now let’s see some examples of them in use!