I am working on a database schema and trying to make some decisions about table names. I like at least a few descriptive names, but when I use the proposed foreign key naming conventions, the result seems ridiculous. Consider this example:
Suppose I have a table
session_subject_mark_item_info
And it has a foreign key that refers to
sessionSubjectID
in
session_subjects
Table.
Now, when I create the foreign key name based on fk_ [referging_table] __ [referenced_table] _ [field_name], I end this madness:
fk_session_subject_mark_item_info__session_subjects_sessionSubjectID
Will this type of foreign key name cause me problems in the future, or is it pretty common to see this?
Also, how do more experienced database developers deal with the conflict between descriptive names for readability compared to long names?
I use MySQL and MySQL Workbench, if that matters.
UPDATE
Got the answers I need below, but I wanted to mention that after some testing, I found that MySQL has a limit on how long the FK name can be. Thus, using the naming convention I mentioned and descriptive table names meant that I had to shorten the names in two copies of my db to avoid MySQL 1059 error
http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html#error_er_too_long_ident
source share