Create a Table in SQL.

  • Below is the code / syntax to create a table in SQL,

The SQL syntax for CREATE TABLE is

CREATE TABLE “Table_Name”

(“column 1” “datatype_for_column_1”,
  “column 2” “datatype_for_column_2”,
… )

  • Create Table for Student, the Table name StudentMst with below Column.

CREATE TABLE StudentMst
(
First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
)

  • If you want to specify the Default values for some column then,

CREATE TABLE StudentMst
(
First_Name char(50),
Last_Name char(50),
Address char(50) default ‘Meera Academy’,
City char(50) default ‘Modasa’,
Country char(25),
)

Leave a Reply

Your email address will not be published. Required fields are marked *

4 × 2 =