MySQL, check if foreign key is assigned to any table
P粉993712159
2023-08-17 12:51:10
<p>I have a table called <code>files</code>
Additionally, I have over 100 tables in which I use associations/foreign keys <code>file_id</code></p>
<p>How do I get all <code>files</code> that do not have an existing association (that is, the file is not attached to any table)? </p>
I usually do this in bash (it might be possible to use SQL, but I'm not sure which table)
Then you will see something related to file_id in each table.