Try It Out Creating a New SQL Server Table

It's your turn to try your hand at creating a new SQL Server table.

1. Create a new table, named tblProducts. To do so, select the Tables node of the Database

Window and click the Create Table In Design View option. Fill in the table elements as shown in Figure 9.13.

Column Name

Data Type

Length

Allow Nulls

-

ProductId

int

4

i

ProductNanne

nvarchar

25

ProductDesc

nvarchar

75

UnitFnce

money

8

UnitsInStock

smailint

2

Discontinued

bit

1

M

<

mi 1

J tblProducts : Table

Columns Default Value

Identity

Formula Format

Lookup

1G 0

Figure 9.13

2. After adding all the table columns and their respective data types, set the ProductId to be the primary key. To set the primary key, select the ProductId field, right-click, and select the Primary Key option in the pop-up list.

3. Now, add some data to the table, such as that shown in Figure 9.14.

0 0

Post a comment