Quackit Logo
Sponsored Links
$1.99 Domain Names
With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.
Create free Flash websites

Creating Database Tables

Print Version

With database management systems, you need to create your tables before you can enter data. Just as you can create a database programatically, you can create your tables programatically too.

Option 1: Programatically

The following is an example of creating a new table. Note that we are specifying the name of the table, the name of each column, and the data type of each column. More parameters can be added to this example if your requirements are more specific.

CREATE TABLE Individual
(IndividualId int,
FirstName Varchar(255),
LastName Varchar(255),
DateCreated dateTime
)

Option 2: User Interface

Database management systems usually have a "Design View" for creating tables. Design view enables you to create the names of each column, specify the type of data that can go into each column, as well as specifying any other restrictions you'd like to enforce. Restricting the data type for each column is very important and helps maintain data integrity. For example, it can prevent us from accidentally entering an email address into a field for storing the current date.

More parameters can be added against each column if you require them. For example, you could specify a default value to be used (in case the field has been left blank by the user).

When you create a table via the user interface (or design view), depending on which database system you use, you should see something like this:

Database table - design view

Once you've created your table in "design view", you can switch to "datasheet view" to see the resulting table. You should see something like this:

Database table in datasheet view

OK, so this is a blank table - it doesn't have any data yet. What we have is a table that contains the columns required before we can enter any data.

So, now that we have a blank table, let's look at how to add data.

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation
  4. Add this page to your favorite social bookmarks sites:      

Oh, and thank you for supporting Quackit!

FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!