Making an essential table includes naming the table and characterizing its segments and every segment's information type.
The SQL Server CREATE TABLE articulation is utilized to make another table.
Syntax
Following is the fundamental language structure of CREATE TABLE articulation −
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns ));
Make TABLE is the catchphrase mentioning to the data set framework what you need to do. For this situation, you need to make another table. The one of a kind name or identifier for the table follows the CREATE TABLE proclamation. At that point in sections comes the rundown characterizing every segment in the table and what kind of information type it is. The linguistic structure becomes more clear to comprehend with the accompanying model.
A duplicate of a current table can be made utilizing a mix of the CREATE TABLE articulation and the SELECT assertion. You can check total subtleties at Create Table Using another Table.
Example
In this model, we should make a CUSTOMERS table with ID as essential key and NOT NULL are the limitations demonstrating that these fields can't be NULL while making records in this table −
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID));
You can confirm if your table has been made effectively by taking a gander at the message showed by the SQL worker, else you can utilize the accompanying order −
exec sp_columns CUSTOMERS
The above order delivers the accompanying yield.
TABLE_QUALIFIER TABLE_OWNER TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME
PRECISION LENGTH SCALE RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE
SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SS_DATA_TYPE
TestDB dbo CUSTOMERS ID 4 int 10 4 0 10 0
NULL NULL 4 NULL NULL 1 NO 56
TestDB dbo CUSTOMERS NAME 12 varchar 20 20 NULL NULL 0
NULL NULL 12 NULL 20 2 NO 39
TestDB dbo CUSTOMERS AGE 4 int 10 4 0 10 0
NULL NULL 4 NULL NULL 3 NO 56
TestDB dbo CUSTOMERS ADDRESS 1 char 25 25 NULL NULL 1
NULL NULL 1 NULL 25 4 YES 39
TestDB dbo CUSTOMERS SALARY 3 decimal 18 20 2 10 1
NULL NULL 3 NULL NULL 5 YES 106
You would now be able to see that CUSTOMERS table is accessible in your data set which you can use to store required data identified with clients.