LiamH Posted February 11, 2009 Share Posted February 11, 2009 Hi all, I have something I just wanted to check with you. I have the following bit of code below; CREATE TABLE tblCategory( CategoryID INT UNIQUE NOT NULL, CategoryName VARCHAR(25) NOT NULL, PRIMARY KEY (CategoryID) ); As you can see I have the PK CategoryID, which I have also stated needs to be unique. I'm just wondering whether I need to have the Unique part in, seen as I already have this field as a PK. I have a feeling that I don't need it, but just thought i'd check. Thanks all Quote Link to comment https://forums.phpfreaks.com/topic/144783-solved-unique/ Share on other sites More sharing options...
rhodesa Posted February 11, 2009 Share Posted February 11, 2009 no, you don't need UNIQUE...PRIMARY KEY makes the field unique Quote Link to comment https://forums.phpfreaks.com/topic/144783-solved-unique/#findComment-759730 Share on other sites More sharing options...
LiamH Posted February 11, 2009 Author Share Posted February 11, 2009 That's what I thought. Thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/144783-solved-unique/#findComment-759744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.