choosing the primary key

[expired user #9968]'s profile image [expired user #9968] posted 8 years ago in General Permalink

hello, I need some help because I could not decide how to choose the primary key of a table, let suppose that I have a sql table that stores news items, each news item is defined by the next fields: newsTitle, newsLink, newsDescription, newsCategoryId. Two different news means two news which have a different title. I mean when is tried to be inserted in the table a news which has the same title with a news which already exists in the table - this case must be forbidden. Firstly I thought to choose as primary key the news title , but is not an int. Have you got any idea which would be the right approach?

[expired user #9968]'s profile image [expired user #9968] posted 8 years ago Permalink

Is there any problem to select the primary key a column which is VARCHAR? and in this case - would make sense to exist a column NewsId?

Please login to leave a reply, or register at first.