Database table is used to store data in column and rows format. Each table has its own name.
Create Table Statement
Using create table sql statement you can create a table inside your database.
Note: Maximum number of column in table is 1024
CREATE TABLE table_name
(
column_name datatype(size),
column_name datatype(size),
column_name datatype(size)….
)
Here, you can give any table name but it should not start with special character accept underscore.
Parameters
column_name – Specify the name of the column inside table
datatype – Type data column can hold inside table, some of common datatype available in SQL Server (eg. Int, char, varchar, decimal, date, datetime)
(size) – Maximum length of data can be in the column
Read more about Datatype of SQL Server
Example
Lets go through simple example to create simple table called CustomerDetails
Here, CustomerID can hold only Integer value and other three columns can hold string value ( it can be character or number or combination of character + number)
If you execute SELECT query against CustomerDetails, There will be no result because nothing is stored.
Note : To insert records in table you can use INSERT INTO statement, Read more about INSERT INTO statement