SQL CREATE TABLE Statement

The SQL CREATE TABLE Statement is used to create a new table in a database.

CREATE TABLE Syntax

CREATE TABLE table_name (
  column_1 datatype,
  column_2 datatype,
  column_3 datatype,
  .
  .
  .
  column_n datatype,
);

CREATE TABLE Conditions

  • The column parameters specify the names of the columns of the table.
  • You should need to gives a columns datatype like VARCHAR, INTEGER, DATA, DECIMAL, CHAR, etc.

EXAMPLE: CREATE TABLE

Suppose, You want to create a "STUDENTS" table, then just use CREATE TABLE statement:

CREATE TABLE STUDENTS (
  ID INT   NOT NULL,
  FULL_NAME VARCHAR (200)   NOT NULL,
  ADDRESS VARCHAR (200),
  CITY VARCHAR (200),
  COUNTRY VARCHAR (200)   NOT NULL
  PRIMARY KEY (ID)
);

CREATED STUDENTS TABLE

Field Type Null Key Default Extra
ID int NO PRI
FULL_NAME varchar (200) NO
ADDRESS varchar (200) YES NULL
CITY varchar (200) YES NULL
COUNTRY varchar (200) NO

NOW, You have STUDENTS table available in your database; just refresh your database and see it.

Policy

GDATAMART.COM is optimized for learning & job information; The users try to improve your knowledge and practical experience through this site but we cannot warrant full correctness of all content... Learn More → | Sitemap →

© 2020 GDATAMART | All Rights Reserved