I am learning about database, I need to know something about the foreign key in MySQL.
Consider the following two tables.
- UserGroupType.
- UserGroup.
UserGroupType:
UserGroup:
In this table the foreign key is defined as follows,
foreign key (GroupType_id) references UserGroupType(GroupType_id)
I just want to know whether the name of the field in UserGroup can be changed? consider the following altered statement.
GroupType:
foreign key (Type_id) references UserGroupType(GroupType_id)
Is it necessary that both the field names must be same?
How to set the default value for datetime?
Thanks in advance, sorry if it is very basic things.