Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Creating a Table doc
Nội dung xem thử
Mô tả chi tiết
Creating a Table
You can use Enterprise Manager to add a table to a database. In this section, you'll add a
table to the Northwind database to store the details of a person. This table will be called
Persons, and will contain the columns shown in Table 2.8.
Table 2.8: DEFINITION FOR THE COLUMNS OF THE Persons TABLE
COLUMN NAME DATABASE TYPE LENGTH ALLOWS NULL VALUES?
PersonID int 4 No
FirstName nvarchar 15 No
LastName nvarchar 15 No
DateOfBirth datetime 8 Yes
Address nvarchar 50 Yes
EmployerID nchar 5 No
To create a table in the Northwind database, you select the Tables node of the Northwind
database in Enterprise Manager and select Action ➣ New Table. You'll then see the table
designer. Add the columns as shown in Table 2.8 to the table, as shown in Figure 2.20.
Figure 2.20: Adding a new table
Note The length of some of the data types is fixed. For example, the int type always uses
4 bytes of storage space, so you can't change the length of an int column from 4.
Similarly, the datetime type always uses 8 bytes of storage space. You can change
the length of nchar and nvarchar columns because those types are designed to store
variable-length data.