Sunday, September 24, 2006

Create a Database Table -- Oracle

A co-worker and I added a table into one of our Oracle databases. Here's what we did.

sql> create TABLE tablename
(columnname1 number(4),
columnname2 varChar2(10),
columnname3 varChar2(10),
columnname4 varChar2(10)
Table created.

create – command

TABLE – type of object to be created

tablename – name given to table, e.g. car

( – begins parameter list

columnname – attribute information, e.g. color

number – datatype e.g. 4, 5 and column width e.g. (4)

varChar2 – datatype e.g. Phoenix123 and column width e.g. (10)

); – ends parameter list

No comments: