This blog is based on the 22/5/19 dat602 class.
Group By, Finding sets within sets.
We think of columns as groups of things but sometimes there are groups within the column. For us to access these and divide the table up by these we can use group by. Some of the different ways these can be used are counting the amount of a certain thing. This could be useful, for example you could count the number of a person with a specific job in a table about a city. I should thing about how I could possibly use it within my project it would certainly be useful but I am currently unsure how I would use it. I might need to look into this more.
Having is another thing with lets a select a specific subset of rows.
Useful commands (show tables;) (describe <tablename>); The first first show what tables we currently have created. The second show a table with all of the row and there attributes. These are useful tool when it comes to managing our database as they allow us to visualize our database which can let us find mistake or errors.
If we try and sum something like the population of all country then we could have a problem where all the countries are added together, this is when group by comes in. Group By allows as to group similar objects together before we sum the objects. This would once again be useful when we add together entities which share an attribute.
Like allows us to compare wild card within mySQL.