iTech College - Internet Technology, Online Education, E-Learning, Technician Training, Tech Tutorials, Distance Education, Virtual Learning SQL Course: Create, Alter and Drop Table - www.itechcollege.com SQL Course: Create, Alter and Drop Table - www.itechcollege.com
Online Degrees Scholarships & Fellowships Internships Student Financial Aid Study Abroad Itech Bookstore
Free Courses
HTML
JavaScript
CSS
ASP
PHP
JSP
ASP.NET
SQL
AJAX
FTP
XML
Career Center
Job List
Web Jobs
Student Jobs
Computer Jobs
Engineer Jobs
Developer Jobs
Job Search
Resume Writing
Job Interview
Salary Info


itech > courses > SQL > Create, Alter and Drop Table

Create Table

create table statement is used to create a new table. Here is the syntax:

  create table tablename
    (
     column1 data type(size),
     column2 data type(size), 
     column3 data type(size)
    );

For example:

  create table members
    (
     userId varchar(25),
     user   varchar(20),
     pass   varchar(20),
     page   varchar(50)
    );

Data types specify what the type of data can be for that particular column. Here are the most common Data types:

char(size) ---------Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
varchar(size) ------Variable-length character string. Max size is specified in parenthesis.
number(size) ------Number value with a max number of column digits specified in parenthesis.
date --------------Date value
number(size,d) ---Number value with a maximum number of digits of "size" total, with a maximum number of "d" digits to the right of the decimal.


Alter Table

We can add a column to a table by using the key words alter table and add:

  alter table members add logoLink(50);

This statement add a column named logoLink to the members table.


Drop Table

To delete a table, we use the key words drop table:

  drop table members;

If you execute this statement, the table named members will be permanently removed.

  Back to Index Page
Next Page >>   Introduction
Select Data
Insert Update and Delete Data
Create Alter and Drop Table
 

SQL Books
SQL Jobs



Bookmark:  del.icio.us digg facebook Reddit Mixx BlinkList Fark Furl NewsVine Simpy Spurl Segnalo Technorati blogmarks Google YahooMyWeb Windows Live



SQL Course: Create, Alter and Drop Table - www.itechcollege.com
Copyright ©2008, itechcollege.com. All rights reserved
iTechCollege | About iTech | Contact iTech