To create a table in MySQL you will need to use the CREATE TABLE function. This is simple enough to use, a simple example of creating a users table is below, it has a unique id (Primary Key) with a unique username and a password field (which I would recommend storing as an MD5). CREATE TABLE users (id INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , username VARCHAR( 16 ) NOT NULL , password CHAR( 32 ) NOT NULL , UNIQUE ( username ) );
The field in a related table that matches a field in another table is called a foreign key. This foreign key establishes the relationship between the two tables in a database.
key
Its best to choose an ID for each table to use as the Primary Key (PK). This is best as an INT due to speed.
Field Name of the table field.Type Column type such as varchar or timestamp.Null Does the field allow null values?Key Is this field a primary key or (a part of) and index?Default Default field value.Extra Additional information such as "on update CURRENT_TIMESTAMP"
No, a primary key do not refers to the whole table .A primary key refers to a field in the table that is not null and unique.
True.
Foreign key field
Access automatically creates an index for the primary key field in a table. In addition, Access automatically creates an index for any field name that contains the following letter sequences: code, ID, key, or num.
key field
A field that uniquely identifies a particular record in a table is called a primary key. The field or fields on which records are sorted is called the sort key.
The primary key.