J
J
JackShcherbakov2018-04-05 20:32:20
MySQL
JackShcherbakov, 2018-04-05 20:32:20

What is the correct way to declare a primary key in MySQL?

Hello colleagues!
What is more correct:

create table users(
user_id 
user_login
PRIMARY_KEY(user_id, user_login)
)

Or
create table users(
user_id PRIMARY_KEY 
user_login UNIQUE
)
?
I deliberately omitted most of the operators.
I would like to thank everyone in advance who will help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2018-04-05
@JackShcherbakov

or. only the syntax must be correct

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question