mysql - SQL: using UNIQUE for column pokemon_master_id -


edited: recognize of might wonder why have 2 'id' values in sql code. have addressed why in particular case seems needed in comment below question.

given following sql code creating table pokemon_users:

create table pokemon_users ( user_id bigint not null auto_increment, pokemon_master_id bigint not null unique, message varchar(255), primary key (user_id) ) 

question 1: would index created column pokemon_master_id?

question 2: if so, difference between index created primary key (user_id), , pokemon_master_id index?

question 1: yes. unique index.

question 2: primary key user_id unique index. difference can have 1 primary key many unique indexes on table.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -