query for create new table code example

Example 1: SQL create a new table

CREATE TABLE table_name
(
column1 TYPE [COLUMN CONSTRAINTS],
column2 TYPE [COLUMN CONSTRAINTS],
column3 TYPE [COLUMN CONSTRAINTS],
[TABLE CONSTRAINTS...]
);

Example 2: how to create table in sql

//to create a table
CREATE TABLE students
( student_id number(4) primary key,
  last_name varchar2(30) NOT NULL,
  course_id number(4) NULL );

//to insert value
INSERT INTO students VALUES (200, 'Jones', 101);
INSERT INTO students VALUES (201, 'Smith', 101);
INSERT INTO students VALUE (202, 'Lee' , 102);

Tags:

Sql Example