[Mysql] how to configure the foreign key table and table-one relationship by navicat? The design of the effect of foreign key

  background:

Now we want to interface to automate the test results persist, but each time you run the current interface test, the test results to project team members by mail. The message reads as follows:

 

  Table Design :

In order to present the results of this: I designed the two tables run_result and run_detail (testcase table already exist)

  • run_detail Table: Test results Details
  • run_result Table: Test Results
  • testcase table: Test Case

 

  Table Relationships :

Run_detail plurality of records in the table, corresponds to a recording run_result (foreign key)

run_detail Table 1 records, must belong to a testcase Table 1 case (one relation)

 

  Analysis process:

run_detail table with the foreign key table run_result

run_detail table by the field result_id RUN_ Result generated table.

run_detail table result_id with RUN_ Result ID value (primary key) in the table should be many to one relationship.

 

run_detail table table-one relationship with the testcase

run_detail table by field testcase_id and testcase generation table.

run_detail ID value (primary key) table with testcase_id testcase table should be one to one relationship.

So run_detail table to ensure testcase_id values are unique.

Configuration: understanding [mysql]-one relationship, and how to set field Navicat Premium uniqueness (UNIQUE)?

 

  Establish many-to-one to one relationship between the table and make the table, need foreign keys

 

run_detail table field design:

  By navicat foreign key for the table design run_detail:

Name can easily play

The first two fields in the current table field takes existing

Column 5 reference field, taking the relationship with the current table has a field in the table

   After the design effects of foreign keys: 

 

 

Guess you like

Origin www.cnblogs.com/kaerxifa/p/11640749.html