Hi
I m thinking about combined key system. say i have mysql table having field
1. user_name
2. father_name
3. mother_name
4. Address

Now I can mark user_name field as key for unique value.
But I dont want that. I want that same user name is possible but same user name, father name and mother name combine is not possible. combined they must unique. mor easily

1. name01, father01,mother01
2. name01, father01,mother02
3. name01, father02,mother01
above data entry may be allow
But I want that
1. name01, father01,mother01
2. name01, father01,mother01
above data entry will not be allowed

Recommended Answers

All 3 Replies

CREATE TABLE student(
name CHAR(100),
father CHAR(100),
mother CHAR(100),
address VARCHAR(255),
PRIMARY KEY (name,father,mother)
)

CREATE TABLE student(
name CHAR(100),
father CHAR(100),
mother CHAR(100),
address VARCHAR(255),
PRIMARY KEY (name,father,mother)
)

thanks it works for me. now how can edit primary key. another question field has been set unique wrongly. how can I ununique now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.