We can't get too far in talking about any Database Management Systems without discussing the concept of a Table and the constituent parts of a Table called Columns and Rows. So let's quickly take a look at these and give them some practical definitions. A Table is the Basic Storage Structure for Data in any Relational Database Management System. Generally a Table is used to contain the data for a specific entity in our application such as a customer or a product. We will generally have many tables within a given database; we will talk more about relationships among tables when we briefly discuss database design later in this chapter, but for now we just need to get down what a Table is. A Table cannot exist without being defined, we Define a Table by describing the kinds of data that the table is to contain, that is, what pieces of information do we want to store that describe a specific entity of the type for which the table is intended. We call these descriptors Columns, so a Column is a part of the definition of a Table. A column exists even before we put any data into the table. Each table must contain at least one column, and a table with only one column isn't terribly useful, so most tables will have many columns. A column has two basic characteristics, a Name which must be unique within that Table and a Data Type which indicates whether that column stores numbers, character strings, or date and time information. We will discuss this more later in this course when we get past these basic definitions, in fact we have an entire chapter devoted to Data Types later in this course. The Content of a Table is then added as Rows of Data, each Row contains a value of the appropriate data type for each column in the table's definition. The values in each row describe specific entity, that is the values in a row all belong together, we can think of a row as the data for an individual member of the table and the values contained in the row as properties of that member. In MySQL there is an additional twist to the way data is stored in a Relational Database Management System, we must assign a storage engine to each table. The Storage Engine determines how the data of that table is to be handled, what files must be set up and maintained for storage of that data and other things. Each Storage Engine offers additional mechanisms and internal structures intended to streamline data access for specific circumstances. There's an entire chapter of this course devoted to some basics of the various Storage Engines and we go into even more detail in the course on MySQL 5 Administration. Here's the way we usually visualize the Table, notice how I have separated the Column Definitions from the data content of the table. Also each Row has an ID value, depending on the storage engine used for the table; there may very well be an internal ID in addition to an ID Column we have defined in the Table Structure. It is always good practice to designate a column or small group of columns as a unique identifier for a row of data. This Identifier is known as the Primary Key, but that gets into the subject of database design, which is what we begin to discuss in the next lesson.
| Course: | MySQL 5 Development (Part 1) |
| Author: | David Swain |
| SKU: | 34225 |
| ISBN: | 1-936334-93-3 |
| Release Date: | 2011-05-27 |
| Duration: | 11 hrs / 129 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |