What is the method for creating a data table in SQL Server?

To create a table in SQL Server, you can use the following statement:

CREATE TABLE table_name
(
    column1 datatype,
    column2 datatype,
    column3 datatype,
    ...
);

In this case, table_name is the name of the data table you want to create, column1, column2, column3, … are the column names in the data table, and datatype is the data type for each column.

For example, to create a data table named customers with three columns – id, name, and age, the following statement can be used:

CREATE TABLE customers
(
    id INT,
    name VARCHAR(50),
    age INT
);

This will create a data table called “customers” with three columns: id as an integer type, name as a string type with a maximum length of 50 characters, and age as an integer type.

bannerAds