Home > Database > Mysql Tutorial > SQL graphical operation settings cascade update and delete

SQL graphical operation settings cascade update and delete

伊谢尔伦
Release: 2016-11-24 15:55:04
Original
1511 people have browsed it

SQL cascade operation settings

To perform cascade operations (such as cascade updates and deletes) on SQL database tables, you first need to set the primary and foreign key relationships of the table. There are two methods:

First Type:

1. Select the database you want to operate

2. Set the primary key for the two tables you want to create a relationship

3. In the database relationship diagram column of this database => Single Right-click => Create a new relationship diagram => Select the table to add a relationship, click Add

4. After completion, two tables will be generated on the window of the relationship diagram, click on a column button of the table Long press the left mouse button and drag it to another table

5. In the newly popped-up "Tables and Columns" window, set the primary and foreign key fields corresponding to the two tables and confirm

6 . In the foreign key relationship window, in the INSERT and UPDATE specification column, set the update rules and deletion rules to cascade, click OK to complete, you can achieve cascade update

Second type:

1. Select the database you want to operate

2. Set the primary key for the two tables you want to create a relationship

3. Click the tree node where you set the foreign key table => in the key column Right-click => New foreign key

4. In the foreign key relationship window, click the button on the right side of the table and column specification column

5. In the new pop-up "Table and Column" window , set the primary foreign key fields corresponding to the two tables, confirm

6. Return to the foreign key relationship window, in the INSERT and UPDATE specification columns, set the update rules and deletion rules to cascade, click OK

Once completed, cascading updates can be achieved

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template