Wednesday 18 November 2015

CREATE command in SQL

CREATE command is used for creating any object on the database server.
Syntax:
CREATE Table<Table_name>(<columnlist1><datatype>[width],…<columnlistn><datatype>[width])
Rules for CREATE command:
  1. Name of the table should always be unique under the database
  2. A table name should not start with numeric’s or special characters
  3. The maximum acceptable size for an object is 128 characters
  4. Column name should be unique under the tables
  5. A table can have maximum 1024 columns
Example:
CREATE table Bank (Custid int, Custname varchar (50), Bal Decimal (7, 2))
Note: SP_Help < Table_name> command is used to view the structure of a table under database
Example: SP_Help Bank



No comments:

Post a Comment