What is a Database Table?

·

·

,
Relational Table

A relational database is made up of several components, of which the table is most significant.  The database table is where all the data in a database is stored, and without tables, there would not be much use for relational databases.

Overall Structure of a Database Table

A database consists of one or more tables.  Each table is made up of rows and columns.  If you think of a table as a grid, the column go from left to right across the grid and each entry of data is listed down as a row.

Each row in a relational is uniquely  identified by a primary key.  This can be by one or more sets of column values.  In most scenarios it is a single column, such as employeeID.

Every relational table has one primary key.  Its purpose is to uniquely identify each row in the database.  No two rows can have the same primary key value.  The practical result of this is that you can select every single row by just knowing its primary key.

columnDatabase Table Columns

Columns are defined to hold a specific type of data, such as dates, numeric, or textual data.  In the simplest of definitions a column is defined by its name and data type.  The name is used in SQL statements when selecting and ordering data, and the data type is used to validate information stored.

So, a DateOfBirth column defined as a date, can be referred to in an order by clause as

ORDER BY DateOfBirth

And, if you try to add a value of “Hello Kitty” to the column, as part of its validation, it will recognize it isn’t a date, and reject it.

Columns names can’t be duplicated in a table.  So, having two “name” columns is a no no.  Though you could have two “name” columns, such as name1, and name2, you’ll learn later on, that this is frowned up, as it breaks normal form (I explain this in another post).

 

Database Table Rows

A database table can contain zero or more rows.  When there are zero, it said to be empty.  There is not practical limit on the number of rows a table can hold; however, remember the table’s primary key may have some influence on this.

What I mean, is that if your table holds states, and the primary key is the state’s abbreviation, then by definition, since there are only fifty states in the union, and you can not have duplicates in a primary key, your table is limited to fifty rows.

There is no guarantee that the rows in a table are stored in a particular order.  Use the ORDER BY clause to do so.

Also, strictly speaking, in a relational database table there is no first or last row.  Yes, you can tease out a first row of a result using a keyword such as LIMIT or TOP, but those are used once the data is retrieved and sorted.  The difference here is that you’re seeing the first row of the result, not what is physically stored in the table.

Wrap up

In summary, you can think of the columns as giving the table its personality and the rows its substance.

Remember!  I want to remind you all that if you have other questions you want answered, then post a comment.  I’m here to help you.

Read More: Database Normalization – in Easy to Understand English >>

15 responses to “What is a Database Table?”
  1. Just want to say thank you and so in my understanding one column like an array name and the raws are the arrays elements

  2. Random Learner

    Hi,
    noticed some errors in the way of spelling possibly

    “Though you could have two “name” columns, such as name1, and name2, you’ll learn later on, that this is frowned up, as it breaks normal form (I explain this in another post).”

    * Is this supposed to be “Frowned Upon”?

    “There is not practical limit on the number of rows a table can hold;”

    *Is “not” supposed to be no? “There is no practical limit”

  3. […] the Hotel Management System ER Diagram schema, it would be much easier to present the included tables and their relationships. The database design presented can be used for your hotel management system […]

  4. […] make database design for Student management system project using its schema and presents included tables and their relationships. Just note that the idea presented here can be used for your student […]

  5. […] with a relational database where we can find all of our data stored in a number of tables. Each of these tables is made up of a set number of columns and a flexible number of […]

  6. Princess

    hi Kris. I am studying for Exam 98-­‐364 Databas Administration
    Fundamentals. I am a beginner in DB. Is there anyway l can get tutorials from you?. Youtube links or articles, anything that can help

    1. Hi, Signup for my email list “Getting Started Learning SQL” that is a good way to get going.

  7. Anderson Welford Chikazingwa

    This is a very, very interesting subject. Thank you Chris. I would like to know much more about Database Development and Management.

    1. Thanks! I’m glad you liked it!

  8. MUHAMMAD SALISU MUHAMMAD

    I APPRECIATE

  9. Audrey

    How can I draw a uml normalization diagram for a bank

    1. Good question! I’m stratring a series on data modeling. Check this out, it should help!

      https://www.essentialsql.com/data-modeling-principles-action/

  10. Audrey

    How can I draw a uml normalization diagram

  11. garvin sweeney

    Hi
    I can’t get my head around the relationship parts of an edr. Can you explain simply step by step

    1. Hi Garvin,

      I would check out this post on Simplified Data Modeling. It explains the difference between primary and foreign keys, and then teach you about one to one and one to many relationships. Those two items are the basics to understanding ERDs.

      IF you are wondering how to split columns out into tables in the first place, then read about normalization here.

      If you have a more specific question, please ask.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from the blog


MySQL PostgreSQL SQLite SqlServer