SQL删除外键

    +--------+--------+
    |A_id    |A_desc  |
    +--------+--------+

    table B:
    +--------+--------+
    |B_id    |B_desc  |
    +--------+--------+

    table c:
    +--------+--------+
    |A_id    |B_id    |
    +--------+--------+

I want to delete 1 row in c table and 1 row in b table without deleting table a by getting value of "B_id", anyone can solve this problem?

you can only do that with triggers / writhing some other code to do that for you.

Note that even if you do use triggers / code, you might get an exception since other records in C can point to table B.

What you can do is run something like:

delete from B where B_id not in (select B_id from C)

after you run the delete