Field:
One features a static thing
recording:
A combination of fields, is represented by a specific thing
table:
Combined record of representing a collection of the same type of thing
Tables and fields, record of the relationship:
Field is a property of things
Record is the thing itself
Table is a collection of things
Column:
Another title field
Attributes:
Another title field
Tuple:
Another record title, each row in the table (i.e., each record in the database) is a tuple, is an attribute for each column. In the two-dimensional table, a tuple is also called a row.
Primary key PK (primary key):
Uniquely identifies a specific thing
Foreign key FK (Foreign Key) :
Associated with a foreign key in another table. It is able to determine the field of another table records.
Relationship represents a table and another table of
For example, a field in the table A, table B is the primary key, then he may be a foreign key A of table. Or a field in the table A, table A is a foreign key, then he may be the primary key table B
Foreign key table:
As:
Table 1 attributes: the typeid (primary key), type
Table 2 attributes: goodid (primary key), the typeid (foreign key, the typeid cited in Table 1)
then:
Table 1 is the primary key of the table , the primary key field in Table 1 as foreign keys in Table 2, and Table 1 did not own foreign keys, table 2 is a foreign key table, there is a dependency table 1typeid field, as a foreign key, value must be It is dependent on its primary key in a table entry some primary key field value.
If Table 1 is associated in Table 2 Table 1 is the primary key for the table, Table 2 is a foreign key table, the false table with 2 associated to Table 3, Table 2, both the primary key table is a foreign key table called the primary key of the table is opposite the said.
|
Primary key |
Foreign key |
index |
definition: |
Uniquely identify a record, it can not be repeated, NOT NULL |
Table foreign key to another table is the primary key, foreign key can be repeated, and may be a null value |
This field value is not repeated, but can have a null value |
effect: |
Used to ensure data integrity |
And to establish contacts with other tables |
It is to improve the speed of query sort of |
Number: |
Only one primary key |
A table can have multiple foreign keys |
A table can have multiple unique index |