Form relationship

xiaoxiao2021-03-06  62

Table relationships are divided into several types: 1. One-on-one relationship requires a primary key table, a foreign key table, the data existing in the primary key table, the foreign key table can be added, and it is actually the primary key, such as: primary key In the table ID is 1, 2, 3, the ID can only be 1 or 2 or 3 in the outer key table, and data not not in the primary key table cannot be added. And cascaded or delete data. Second, a pair of multi-relations in this relationship, the rows in Table A can have many match lines in Table B, but the rows in Table B can only have a match in Table A. For example, the Publishers table and Titles table are a couple of relationships: Each publisher can publish many books, but each book can only have one publisher. (Individual Understanding: The Pub_ID in the main table publishers is the primary key, so there can be only one match. The PUB_ID in the outer key table is not a primary key, so there can be a lot of rows). Three, more and more relationships in multiple relationships

In, a line in Table A can match multi-line in Table B, and vice versa. By definition

Connection table

A third party table creates such a relationship that the primary key of the connection table includes the foreign key in Table A and Table B. For example, the Authors table and Titles tables are multi-to-many relationships, which is defined by a pair of multi-relationships from each table in these tables. The primary key of the TitleAuthors table consists of a AU_ID column (the primary key of the Authors table) and the title_id column (the primary key of the Titles table).

转载请注明原文地址:https://www.9cbs.com/read-113541.html

New Post(0)