For example, if I have two tables Teacher
and Student
that would have a column named IDNumber
, do I have to name the indexes separately like this:
IDNum_teach IDNum_stu
Or could I just create an index on each table for IDNumber
and name them both IDNum
?
Yes you can use same index name for both the tables.
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX IDnum [index_type] ON tbl_name (index_col_name,...) [index_type]
Each table in an SQL database is essentially independent. So, yes, you can use the same column name IDNumber
in each table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With