How to make a composite primary key on phpmyadmin. such that student id is combination of year and roll number. sid = 112132 , 11 of year 2011 and 2132 is roll number?? anybody help..
Go to table structure tab and select all columns which you wish to set as combination of primary keys and from horizontal options at bottom (just above the border), click to Primary which will set them as composite primary key.
A Composite Primary Key is created by combining two or more columns in a table that can be used to uniquely identify each row in the table when the columns are combined, but it does not guarantee uniqueness when taken individually, or it can also be understood as a primary key created by combining two or more ...
Adding a Primary Key to a New Table In phpMyAdmin. When creating a new table in phpMyAdmin, select PRIMARY from the Index dropdown on the column that will be the primary key. Check the box in the A_I column if this will be an auto incrementing key.
If the table is already created:
You can now also define the keys while creating the table as mentioned in @amila's answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With