Hi! Today I learned about the Create Table statement, it allows you to create and define tables, as what I studied on the last episode, it is a DDL statement (Data Definition Language).


The syntax for this statement in SQL Server (TSQL) id:

CREATE TABLE table_name (

column1 datatype [NULL | NOT NULL],

column2 datatype [NULL | NOT NULL],




Let’s look at an example of how to use the CREATE TABLE statement in the TSQL.

TSQL Create Table

This example creates a table called employees which have 4 columns.

  • The first column is called Employee_ID which is created as an INT datatype and can not contain NULL values.
  • The second column is called Last_Name which is a VARCHAR datatype (the number “50” inside the parentheses means that the maximum characters in length are 50) and also can not contain NULL values.
  • The third column is called First_Name which is a VARCHAR datatype but can contain NULL values.
  • The fourth column is called salary which is a MONEY datatype which can have NULL values.


The detail that this statement has is that it isn’t defined a primary key for the table in TSQL. The primary key is a single field or combination of fields that uniquely defines a record.

Something that I guess you could realize is that I mentioned many times about datatypes, this is the next subject that I’m going to learn but I’ll create a new article about it, to make it easier.

Leave a Comment

Your email address will not be published.