How to Create a Table in SQL?

 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 *

9 + 3 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">