Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Exploring the Northwind Database A database may have many tables, some of which are related to each other. For example, the North-wind database contains many tables | Exploring the Northwind Database A database may have many tables some of which are related to each other. For example the North-wind database contains many tables four of which are named Customers Orders Order Details and Products. Figure 2.11 is a repeat of the diagram shown earlier that illustrates how these tables are related. Figure 2.11 Relationships between the Customers Orders Order Details and Products tables The columns for each table are shown within each box. For example the Customers table contains 11 columns CustomerID CompanyName ContactName ContactTitle Address City Region PostalCode Country Phone Fax In the next few sections you ll learn some database theory and then you ll learn how each of the previous columns is defined in the Customers table. You ll also explore the Orders Order Details and Products tables. Primary Keys Typically each table in a database has one or more columns that uniquely identify each row in the table. This column is known as the primary key for the table. A primary key can be composed of more than one column. In such cases it is known as a composite key. Note The value for the primary key in each row of a table must be unique. In the case of the Customers table the primary key is the CustomerID column. The key icon shown to the left of the CustomerID column in Figure 2.11 indicates that this column is the primary key for the Customers table. Similarly the primary key for the Orders table is OrderID. The primary key for the Order Details table is composed of two columns OrderID and ProductID. The primary key for the Products table is ProductID. Table Relationships and Foreign Keys The lines that connect the tables in Figure 2.11 shown earlier display the relationships between the tables. The infinity sign ro at the end of each line indicates a one-to-many relationship between two tables meaning that a row in one table can be related to one or more rows in the other table. For example the Customers table has a one-to-many .