Page 48 - SQL
P. 48

Chapter 11: CREATE TABLE




        Introduction



        The CREATE TABLE statement is used create a new table in the database. A table definition
        consists of a list of columns, their types, and any integrity constraints.


        Syntax



            •  CREATE TABLE tableName( [ColumnName1] [datatype1] [, [ColumnName2] [datatype2] ...]
              )


        Parameters



          Parameter     Details


          tableName     The name of the table

                        Contains an 'enumeration' of all the columns that the table have. See Create a
          columns
                        New Table for more details.



        Remarks



        Table names must be unique.


        Examples



        Create a New Table


        A basic Employees table, containing an ID, and the employee's first and last name along with their
        phone number can be created using


         CREATE TABLE Employees(
             Id int identity(1,1) primary key not null,
             FName varchar(20) not null,
             LName varchar(20) not null,
             PhoneNumber varchar(10) not null
         );


        This example is specific to Transact-SQL


        CREATE TABLE creates a new table in the database, followed by the table name, Employees

        This is then followed by the list of column names and their properties, such as the ID




        https://riptutorial.com/                                                                               30
   43   44   45   46   47   48   49   50   51   52   53