Edit after the question has been clarified.
The definition of a primary key is that there is one and only one. So, no you cannot create two primary keys on two different columm.
You can however create a primary key on one column and a unique constraint on another:
create table person
(
surname varchar(100) not null primary key,
name varchar(100) not null,
constraint only_one_name unique (name)
);
The above is standard SQL for all I know.
Here is a link to the book "SQL-99, Complete" which re-states the SQL standard in a more pragmatic way: https://mariadb.com/kb/en/constraint_type-primary-key-constraint/
Quote from the book:
A Base table may be constrained by no more than one PRIMARY KEY Constraint
The original wording from the SQL standard (which is not free, so no one can give you a link to that):
A <table definition>
shall specify at most one implicit or explicit <unique constraint definition>
that specifies PRIMARY KEY
.
(Emphasis mine)
Note that you almost never want char
- especially not with a length greater than just two or three characters. The CHAR
datatype pads all values to the defined length. So if you inserted the value 'FOO'
into a CHAR(10)
column it will (has to) be stored as 'FOO '