A
aniruthan
Hello everybody,
I am the newbie in the database normalization. What is the advantage of
using a surrogate key? I have designed a database where the user will
belong to one primary group and member of other groups. I designed the
entity(table) group with a surrogate key so that can referenced in a
users table for group membership details. One of my colleague insists on
using the group ( Ex. animation) itself as PRIMARY KEY instead of using
surrogate key since it reduces the number of queries ( Ex. To find out
the membership if I use surrogate key I have to refer to the groups
table and display the groups whereas if I use the group name itself as
primary key I need not use two tables)
The scanario is
groups table
group_id(PK) group name other fields
1 leather
2 IT enabled services
3 Education
user table
user_id primary_group secondary_group
1 1 2-3
In the second approach it becomes
group table
group_name(PK) other fields
Leather
IT enabled services
Education
users table
user_id primary_group secondary_group
1 leather Education-IT
enabled serrvices
Can anybody help me to resolve this?
Thanks in advance
I am the newbie in the database normalization. What is the advantage of
using a surrogate key? I have designed a database where the user will
belong to one primary group and member of other groups. I designed the
entity(table) group with a surrogate key so that can referenced in a
users table for group membership details. One of my colleague insists on
using the group ( Ex. animation) itself as PRIMARY KEY instead of using
surrogate key since it reduces the number of queries ( Ex. To find out
the membership if I use surrogate key I have to refer to the groups
table and display the groups whereas if I use the group name itself as
primary key I need not use two tables)
The scanario is
groups table
group_id(PK) group name other fields
1 leather
2 IT enabled services
3 Education
user table
user_id primary_group secondary_group
1 1 2-3
In the second approach it becomes
group table
group_name(PK) other fields
Leather
IT enabled services
Education
users table
user_id primary_group secondary_group
1 leather Education-IT
enabled serrvices
Can anybody help me to resolve this?
Thanks in advance