T-SQL Tutorials - TSQLTutorials.com

CREATE TABLE


Introduction

The CREATE TABLE statement is how new tables are created in SQL. Tables are the structures that hold data, in a relational database. The syntax for using the CREATE TABLE command is as follows:

  • CREATE TABLE [table name]
    (
      column name 1 datatype for column,
      column name 2 datatype for column
    )

Beginning Example

In this example we will create a simple 'Employees' table with a 'Name' column, 'Position' column and a 'Salary' column: CREATE TABLE Employees
(
  Name varchar(20),
  Position varchar(25),
  Salary int
)




Second Example

In this next example we will create the same 'Employees' table, but this time we will create an auto-incrementing primary key. CREATE TABLE Employees
(
  EmployeeKey int IDENTITY(1,1) PRIMARY KEY,
  Name varchar(20),
  Position varchar(25),
  Salary int
)


Microsoft SQL Server 2014 Standard Edition Server w/20 CAL’s

Price: $641.99
Buy It Now
Microsoft SQL Server 2008 R2 Standard Server License key +5CAL FactorySealedPack

Price: $495
Buy It Now
Microsoft SQL Server 2012 Standard 10CAL +Server License Key Factory Sealed Pack

Price: $899
Buy It Now
Microsoft SQL Server 2012 Standard with SP3 - 25 CAL License - SAME DAY DOWNLOAD

Price: $700
Buy It Now
Lenovo Microsoft SQL Server 2014 - License - 1 User CAL - OEM

Price: $169.99
Buy It Now
Microsoft SQL Server Standard 2014 + 10 Cal

Current Price: $122.5
Current Bids: 8







Copyright 2017 - TSQLTutorials.com