August 7, 2010

Example of Create table in sql

This is a simple example to learn how to create table in sql with different data types and columns. You can see also how to add foreign key in table in create syntax.

 create table Authors  
 (  
 AuthorNumber number primary key,  
 RefNumber varchar2(10),  
 LastName varchar2(40),  
 FirstName varchar2(40) null,  
 Organization varchar2(50) null,  
 city varchar2(50) null,  
 State varchar2(30) null,  
 Country varchar2(40) null,  
 Address varchar2(200) null,  
 email varchar2(50) null,  
 Phone varchar2(50) null,  
 Fax varchar2(50) null,  
 foreign key(RefNumber) references papermst(RefNumber)  
 );