Create uniqueness by two fields

In mysql, we can create a role to define a unique index that defined by two fields, so if a new entry from those two fields (field1 AND field2) different from existing data (field1 AND field2 data) then it will be allowed to be inserted and it doesn’t matter if field1 (only) has same data of two or more.

You can define it by this command :

mysql> USE <DBASE NAME>

mysql> ALTER TABLE <table name> ADD UNIQUE (<field1>,<field2>);

Advertisements

11 thoughts on “Create uniqueness by two fields

  1. That’s the issue with her. She’s an absolutely superb talent. It is so moving to have to see her destroy it by getting caught up in all that bad stuff. She should go to rehab, or book into a help program, or get a better coach. Will she ever tour in the future? I’d sell my granny to see her perform, her shows are amazing.

  2. The trouble with her is always exactly the same. We should only feel sad for the wee thing. The girl should get some program of sorting herself out or personal coaching or training or something. I absolutely enjoyed her recent record, and I’d hate it if we wouldn’t be hearing her beautiful voice any more.

  3. Just read it and went gosh, I know why I was poor in the debate class. – If my films don’t show a profit, I know I’m doing something right. – Woody Allen Born 1935

  4. Interesting post reminds me of another gem. – I don’t care if it doesn’t make a nickel. I just want every man, woman, and child in America to see it. – Samuel Goldwyn 1882 – 1974

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s