☰ See All Chapters |
MySQL Tables: The Primary Storage for Data
The table is the primary storage structure for data in a relational database. Table consists of row(s) and column(s), column(s) with defined name and data types. Tables consume physical storage space in a database and can be permanent or temporary.
Columns
Each column is assigned a specific data type. The data type determines what kind of data the column is allowed to hold. This enables the designer of the table to help maintain the integrity of the data.
Tables cannot be defined without column and at least one column is necessary.
Tables can exist without rows or without any records.
Column name cannot contain spaces and should be a continuous string. Limit for the length of name depends on the database implementation. Names for databases, tables, columns, and indexes can be up to 64 characters long in MySQL.
It is typical to use underscores with names to provide separation between characters. For example, a column for the customer’s name can be named EMPLYEE_NAME instead of EMPLOYEENAME. This is normally done to increase the readability of database objects.
Rows
A row is a record of data in a database table. For example, a row of data in a customer table might consist of a particular customer’s identification number, name, address, phone number, and fax number.
A table can contain as little as one row of data and up to as many as millions of rows of data or records.
All Chapters