Chapter 4. Using the Database
In This Chapter
Storing data in the database
Viewing and retrieving data from the database
Updating data
Deleting data
An empty database is like an empty cookie jar — you get nothing out of it. And searching an empty database is no more interesting or fruitful than searching an empty cookie jar. A database is useful only with respect to the information that it holds.
A database needs to be able to receive information for storage and to deliver information on request. For instance, the CustomerOrderInformation database needs to be able to receive the customer and order information, and it needs to be able to deliver its stored information when you request it. If you want to know the address of a particular customer or the date a particular order was made, for example, the database needs to deliver that information when you request it.
Your MySQL database responds to four types of requests:
Adding information: Adding a row to a table.
Updating information: Changing information in an existing row. This includes adding data to a blank field in an existing row.
Retrieving information: Looking at the data. This request does not remove data from the database.
Removing information: Deleting data from the database.
Sometimes your question requires information from more than one table. For instance, the question, "How many orders did customer Joe Smith place during the months April and December?" requires information from multiple tables. You can ask this question ...
Get PHP & MySQL® Web Development All-in-One Desk Reference for Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.