Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to create table in SQL in Queries of SQL Queries
2834 Views
Hints 
create table used to create table in database.Table has columns and rows structure.When creating a table given parameters are table name, column names and its datatype, size of the column.

In the following example you can able to see the parameters.Data types -int,nvarchar,varchar,datetime,double etc..,
Syntax
create table tableName(
columnName1 dataType(size) null(or) not null,
columnName2 dataType(size) null(or) not null,
columnName..n dataType(size) null(or) not null);
Example
Create the tables Customers and Orders with the following columns.
(do not declare the corresponding primary and foreign keys)

create table Customers(
Customerid char(5) not null,
CompanyName varchar(40) not null,
contactName char(30),
Address varchar(60),
City char(15),
Phone char(24),
Fax char(24));
create table Orders(
Orderid int not null,
CustomerId char(5) not null,
Orderdate datetime,
Shippeddate datetime,
Freight money,
Shipname varchar(40),
Shipaddres varchar(60),
Quantity int );
Previous Topics
Previous lessons of current book.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details