The Tables of a Database


Tables Fundamentals



A table is primarily a list of items or a group of lists. To manage such a list, it should be meticulously organized. To organize this information, it is divided in sections. Here is an example:

Name Age Gender Relationship
Judie 18 Female Sister
Ernest 24 Male Cousin
Bill 52 Unknown Uncle
David 36 Male Brother
Hermine 12 Unknown Niece

Based on this, a list is simply an arrangement of information and this information, also called data, is stored in tables.


Practical Learning Practical Learning: Starting a Database

  1. Start Microsoft SQL Server. In the MMC window, expand the Databases folder
  2. In the left frame, right-click Databases and click New Database...
  3. On the Database Properties dialog box, click the General property sheet.
    In the Name text box, type BCR
  4. Click the Data Files property page
  5. Click under Initial Size (MB) and type 10
    Accept the Filegroup as PRIMARY
  6. Click the Transaction Log property page
  7. Click under Initial Size (MB) and type 2
  8. Click OK

Visual Creation of a Table

The information of a table is organized in categories called columns and horizontal arrangements called records or rows. A column holds a category of data that is common to all records. A table must have at least one column. This means that you cannot create a table without defining at least one column.


Practical Learning Practical Learning: Creating a Table

  1. In the left frame, click the + sign of BCR to expand it.
    In the left frame, right-click Tables (under BCR) and click New Table...
  2. As the cursor is blinking in the first empty field under the Column Name column, type name and press Enter

Tables Names

To complete the creation of a table, you must save it. If you are freshly creating a table and decide to save it, you would be prompted to name it. The name of a table:

  • Can be made of digits only. For example you can have a table called 148
  • Can start with a digit, a letter, or an underscore
  • Can be made of letters, digits, and spaces

Besides these rules, you can make up yours. To avoid confusion, here are the rules we will use to name our tables:

  • A name will start with a letter. Examples are act or Second
  • After the first character as an underscore or a letter, the name will have combinations of underscores, letters, and digits. Examples are _n24, act_52_t
  • A name will not include special characters such as !, @, #, $, %, ^, &, or *
  • We will not use spaces in a name
  • If the name is a combination of words, each word will start in uppercase. Examples are DateHired, RealSport, or DriversLicenseNumber

Practical LearningPractical Learning: Naming a Table

  1. To save your table, on the toolbar of the table, click the Save button Save
  2. In the Choose Name dialog box, type Employees and press Enter
  3. After saving the table, close it by clicking its system Close button

SQL Creation of a Table

In SQL, to create a table, you start with the following statement:


The CREATE and TABLE keywords must be used to let SQL know that you want to create a table. The TableName factor specifies the name of the new table. The TableName can use the rules and suggestions we reviewed for the tables.

After specifying the name of the table, you must create at least one category, called a column of data. The column must be entered in the parentheses that follow the name of the table. A column is specified with a name and a data type. The name can follow the rules and suggestions we reviewed for the tables. The formula you use would be:

CREATE TABLE Country(ColumnName DataType)

In the next lesson, we will go through the details of creating a table and its columns. 


Previous Copyright © 2004-2012, FunctionX Next