You can create tables by using DDL or
by using the table designer within SSMS. No matter which approach you
choose to use, it all comes down to T-SQL. If you create tables from
the table designer, the designer generates and executes T-SQL on your
behalf. That’s convenient, because it saves you a lot of tedium in
writing the T-SQL yourself. But sometimes writing your own T-SQL has
advantages.
1. Creating Tables from the Table Designer
To launch the table designer, simply navigate
to the Tables node of the VetClinic database, right-click the node, and
select New Table from the context menu. This will launch the table
designer, shown in Figure 1.
Figure 1. Table designer in SSMS
From the options visible in Figure 1,
you can see that the majority of the common configuration options are
available, such as the data type of the column and whether nulls are
allowed. The table designer provides you with the ability to easily configure a
new table by exposing the most common options used for table creation.
To start adding columns, click the first empty row. Type store_id
in the Column Name column, and select int for the data type. Deselect
the Allows Nulls check box. Right-click the row, and select Set Primary
Key.
In the second row, type store_zip_code in the Column Name column, and select int for the data type.
To create the table, click the disk icon, and
press Ctrl+S or select Save Table_1 from the File menu in SSMS. The
table designer launches, giving the new table a name of Table_1
.
When you save the table, SSMS will ask you for a different name. It is
in this save dialog box that you can specify Store Location for the
table name.
When the table is saved, it is actually now created within the database.