Let’s assume that you are working for a audio store and need to create a database to hold details about all the types of devices in the store. You are told that there are nine families of devices—Amplifier, minidisc, DVD, C-casette, Turntable, DAT, DCC, Turner, and DAB—so you’ll need a column for that. Then each device has been given a name, so that’s another column, and you also want to keep track of their ages, which is another. Of course, you will probably need more columns later, perhaps to hold voltage requirements, and other details, but for now that’s enough to get going. A unique identifier is also needed for each device, so you also decide to create a column for that called id.
The code you might use to create a MySQL table to hold this
data, with the main query assignment in bold text.
Creating a table called devices
As you can see, the MySQL query looks just like what you would type directly at the command line, except without the trailing semicolon.