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
Free Courses
HTML
JavaScript
CSS
ASP
PHP
JSP
C++
ASP.NET
SQL
AJAX
FTP
XML

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


Online Education, Online Training for Your Job, Distance Education, E-learning Programs for Your Career!Online Colleges, Online Universities, E-learning & Distance Education for Your Career! Easy Job Training & Online Courses.


   Email A Friend  
 
Earn Online Degree
for Your Job
I found a job after I earned an online degree!
Online classes for finding a Job. Online College, Online University, Degrees, E-learning school, online certificate Earn your
online degree now!
Online Training
for Good Job
Why I work so hard but earn so little? Why I cannot find a high paying job?
Online training for a Good Jobs. Online Degree, E-learning school, online certificate Go to
online school now!

Copyright ©2024, itechcollege.com. All rights reserved
iTechCollege | About iTech | Contact iTech