sql server create table

how to  sql server create table

This command is used to create the database objects within the database

Syntax:

CREATE TABLE <TABLE NAME>

(COL 1 DATA TYPE (size),

COL2 DATA TYPE (size),

:

:

:

:

COLN DATA TYPE (size));

Rules for Creating a Table:

Table name must be unique under the database.

Never start table name with numeric or special characters except underscore’_’.

Do not use space in table name if we want give space in table name then use underscore symbol only.

Every table name should contain minimum one character to maximum 128 characters.

The maximum no. of columns a table can have 1024 columns.

Example

see the table in

After creating the table if we want to know the structure of the table any time use the statement .

Syntax:-

Sp_help<table>

Here

Sp_hepl customer

table structure

CREATE TABLE in SQL with primary key

  • When we are use primary key in create table