MySQL for Other Applications: Manipulating Data
- Working with data
- MySQL for Other Applications
- Multiple tables
- Manipulating Data: Statistics
- There are several statistical functions available. Some of the simplest are max(), min(), avg(), and count(), for the maximum value, minimum value, average value, and number of values in a set of records.
- Update Data
- What happened is that, for some of our albums, we didn’t know what the purchase date was, and when we imported the records, somewhere in the import the data went from empty to zeros. Display those albums with:
- Group Selection
- Let’s take a look at grouping data. For example, we know how to find out the average year of all of the albums we purchased, but what about the same information for a single artist?
- Replacing text
- Sometimes you’ll want to replace text inside of other text. You’ll use the “update” statement for this as well, using the body() function. For example, if you want to replace all occurrences of “Beetles” in your album names with “Beatles”, whether the word occurs on its own or inside some title such as “The Beetles at Carnegie Hall”, you would do this: