Multiple tables to correlate queries----> Delete a certain data when there is a note of their own record

Source: Internet
Author: User

When multiple tables are associated with a query, when one of the fields in a table is defined in another table, it is equivalent to one table being a sub-table of another table, such as a problem that is currently being developed:

This is the problem when deleting the data inside the Sys_user table, because Sys_user (System user) contains the user_id field, and in the other table (which is the child table of Sys_user) (sys_user_role "System User Role Table": Define the System User function menu--->sys_user inside the user_name function) also has user_id;

When confronted with such a situation, the solution is:

1. Query to delete all data from the child table inside the parent table

2. Delete the data from the child table

3. Delete the data inside the parent table

Multiple tables to correlate queries----> Delete a certain data when there is a note of their own record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.