Creating table: – A creation of table is one of the most important feature of DDL. After creating table, user can store data in the table. To create a table, user assign table name, column name and column type. Table name is a name defined by the user. Some important rules for crating table names –
- A Table name can be maximum of 63 character long including alphanumeric characters and underscore sign.
- A sequence of alphabetic latter’s followed by a sequence of numeric design can be use a table name. under score sign can be use between either two alphabetic letter or between a letter and a digit.
- No extra sign can be use with a table name.
- Upper case letter and lower case letter treated as different because it is case sensitive language.
Column name is also an user define word. The column name should follow same as rules of table name. column is similar as variable which hold a value.
Colum type is a data type. Column types are predefining word and it can we use with or without size. If size is defined with column type, size must be specifying inside small bracket.
The create command is used to create a new table in SQL. User must not use same name of existing table. Syntax of the create command is –
Create Table <Table Name> (<Column Name> <Column Type> (Size), <Column Name> <Column Type> (Size), - - -);
Multiple column can be use with a table name. column name, column type and column size must be specified with in small bracket. At the end of statement, a semi colon terminator must be use. If our syntax is correct, a message “Table Created” will be displayed otherwise an error message will be display as DDL. An example of table creation is –
Create Table Company (CName char(10),Location char(10));
In case of above example company is table name, cname and location are column name and char is column type.