4.1. The Basics of MySQL Data Storage

MySQL is a relational database management system, which lets you store data in multiple tables, where each table contains a set of named columns and each row consists of a data entry into the table. Tables will often contain information about other table entries, which allows developers to group relevant information into smaller groups to ease a script's load on the server, as well as simplifying data retrieval.

For example, take a look at how you might store information about musical artists (see Tables 4-1 and 4-2).

Table 4.1. The artists Table
artist_idartist_name
1Bon Iver
2Feist

Table 4.2. The albums Table
album_idartist_idalbum_name
11For Emma, Forever Ago
21Blood Bank - EP3
32Let It Die
42The Reminder

The first table, artists, includes two fields. The first field, artist_id, stores a unique numerical identifier for the artists. The second column, artist_name, stores the artist's name.

The second table, albums, stores a unique identifier for each album in the album_id column and the album name in the—you guessed it!—album_name column. The album table includes a third column, artist_id, that relates the artists and albums tables. This column stores the unique artist identifier that corresponds to the artist that recorded the album.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.122.82