Tables In ASP

Tips >> ASP

These article will explain you how to create tables in asp and explain you the importance of tables in ASP. Tables can be defined as the heart of the majority of the website and Articles. Tables lay the groundwork for most web sites. The majority of web sites designed today are completely contained within tables. You need not look any further than this very web site for an example of this. Everything you see on this screen is contained within a table. Some of the content you see is inside of tables which are inside of other tables, this is called Nesting.
So why would you want to put the content of a web page into a table? The reason is that it is the simplest and most effective way to organize a web page. For example, how would you make two columns of text on a web page if you did not use a table? Think about it. Unless you are an advnaced HTML'er and know how to use layers, you can's do it. What you would do is create a table with two columns and then place your text in each column

To create a database we need to apply the following code :-

CREATE DATABASE database_name

To create a table in a database the below are the following steps :-

CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
.......
)

It can be better explained with an Example :-


This example demonstrates how you can create a table named "Person", with four columns. The column names will be "LastName", "FirstName", "Address", and "Age":-

CREATE TABLE Person
(
LastName varchar,
FirstName varchar,
Address varchar,
Age int
)


This example demonstrates how you can specify a maximum length for some columns :-

CREATE TABLE Person
(
LastName varchar(30),
FirstName varchar,
Address varchar,
Age int(3)
)

The data type specifies what type of data the column can hold. The table below contains the most common data types in SQL :-

Data Type Description
integer(size)
int(size)
smallint(size)
tinyint(size)
Hold integers only. The maximum number of digits are specified in parenthesis.
decimal(size,d)
numeric(size,d)
Hold numbers with fractions. The maximum number of digits are specified in "size". The maximum number of digits to the right of the decimal is specified in "d".
char(size) Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis.
varchar(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis.
date(yyyymmdd) Holds a date


The following are the methods that describe how to Create Index :-

Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries.
Note :-
Updating a table containing indexes takes more time than updating a table without, this is because the indexes also need an update. So, it is a good idea to create indexes only on columns that are often used for a search.

The Index can further be Classified into two types :-

  • A Unique Index :- Creates a unique index on a table. A unique index means that two rows cannot have the same index value.
  • A Simple Index :- Creates a simple index on a table. When the UNIQUE keyword is omitted, duplicate values are allowed.
 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

+91-9967648641

+91-9967648641