|
Note: - In the syntax of the queries brackets [ ] denote optional value and the examples are based upon the database in the previous section.
CREATE TABLE: - It is used to create an empty table in the database. Syntax: -
create table <table Name> (
<column 1> <data type> [not null] [unique] [<column constraint>],
. . . . . . . . .
<column n> <data type> [not null] [unique] [<column constraint>],
[<table constraint(s)>]
);
Examples: -
Creation of Teacher Table: -
create table Teacher ( TeacherID Number(10) , TeacherName Varchar2(30), Qualification Varchar2(30), Subject Varchar2(30), ContactNumber Number(10) );
In the above example a table will be created with the name Teacher and TeacherID, TeacherName, Qualification, Subject and ContactNumber fields. This way we create all the tables discussed in the previous section. |