curiouswebster
asked on
MySQL: I need to create a primary key on contact_id
I need to make contact_id a Primary key, unique and auto-incrementing. Could you provide me the script?
It seems, the phpMyAdmin panel may not have that ability to do all three. Plus, I prefer a script which I can save or later.
When I click MySQL's INSERT option, I see the wrong query created. (I did not insert a Default value, since I want that auto-generated.)
So, the INSERT option includes that contact_id field.
INSERT INTO `ps_contacts`(`contact_id`, `username`, `password`, `email`, `fname`, `lname`) VALUES ('[value-1]','[value-2]','[value-3]','[value-4]','[value-5]','[value-6]')
Please provide me the script which include that one field, contact_id, as a Primary key, unique and auto-incrementing.
Thanks
It seems, the phpMyAdmin panel may not have that ability to do all three. Plus, I prefer a script which I can save or later.
When I click MySQL's INSERT option, I see the wrong query created. (I did not insert a Default value, since I want that auto-generated.)
So, the INSERT option includes that contact_id field.
INSERT INTO `ps_contacts`(`contact_id`, `username`, `password`, `email`, `fname`, `lname`) VALUES ('[value-1]','[value-2]','[value-3]','[value-4]','[value-5]','[value-6]')
Please provide me the script which include that one field, contact_id, as a Primary key, unique and auto-incrementing.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Open in new window
https://dev.mysql.com/doc/refman/8.0/en/integer-types.html provides the integer types you'll likely use.