This is my code
CREATE TABLE mactor( pid VARCHAR(30) UNSIGNED NOT NULL AUTO_INCREMENT, fname VARCHAR(30) NOT NULL, lname VARCHAR(30) NOT NULL, gender VARCHAR(20) NOT NULL, PRIMARY KEY (pid));
and this is the error
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘UNSIGNED NOT null AUTO_INCREMENT,
fname VARCHAR(30) NOT NULL,
lname…’ at line 2.
I am very confused and I don’t want to use any other values as my primary key other than VARCHAR. please help!
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Remove the UNSIGNED; unsigned can only apply to numeric types, not character or binary types. You will also need to get rid of AUTO_INCREMENT; you can’t auto increment a character type.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0