
The MySQL Workshop
By :

In the previous chapter, we covered querying a single table. We used WHERE
to filter out the rows we were interested in, and we used GROUP BY
to aggregate rows into groups of rows to then use aggregate functions such as COUNT()
and SUM()
. We also learned about working with JSON data.
In a relational database such as MySQL, data is stored across multiple tables. The reason for doing this is that it avoids storing the same piece of information multiple times.
An example of this is a database for a simple website with comments. It probably has a table of users consisting of values such as username, display name, and password hash. Then it has a table named posts that stores all the posts, and then there is a table with comments. The comment table stores a reference to the post the comment is linked to and a reference to the user commenting.
If the user changes their password, then only one table has to be updated. And if a comment...