The following are some of the key terms and concepts used in this book.
A database is simply a collection of data. When we create a database in MySQL, we are creating a collection of data related to a similar topic. We cannot add data directly to a database; instead, we have to work with tables.
Tables are where data is stored. A database may have many tables, and tables may be dependent on one another.
A record is an item in a table. If you have a database named books and a table named library, a record is the row of data that makes up the entry for a single book.
A field is an item in a record. If you have a table named library, a record would be an individual item in that record, such as 'book title'.
A primary key is a field that is unique to a table, and it cannot be NULL. Primary keys are used to ensure that records are unique in a database. Also, primary keys are used in the normalization of databases.
Database normalization is a large topic when it comes to database design. The goal behind database normalization is to create links between database tables to minimize, or eliminate, the need for redundant data.
A relational database arranges data into tables. These tables can then have relations among them to minimize redundant data being stored in the database. Consider that you have a database for ice hockey, with teams, players, stats, etc. A player can only be on one team at a time, so you could have a separate table for the team, that just contained the team's data, and another table for the players. Inside of that player data, you could create a 'relation' to the team that they are on. This relation eliminates the need to have to type the team data over and over again for each player on the team. Instead, each player just has a relation to the team.
Several database interfaces are available for Perl. We use the DBI module throughout this book. This is also the interface you are most likely to come across. The DBI module has many database drivers (DBDs) for the multitude of databases that exist. We use the DBD::mysql the most, but we also touch on the DBD::Oracle, DBD::Pg for Oracle, and PostgreSQL, respectively. There is also DBD::CSV for working with comma separated text files.