How to name constraints in Mysql?

Asked

Viewed 103 times

1

I’m trying to name constraints in the MySQL but unsuccessfully, I’m doing it this way:

create table if not exists pessoas
(
    id int auto_increment,
    nome varchar(30) not null,
    data_nascimento date,
    constraint pk_pessoa primary key(id)
) default charset = utf8;

When I execute the command show create table pessoas mine constraint is not defined and when I try to do alter table pessoas drop index pk_pessoa I get an error. Where I am missing?

  • 1

    If possible click on [Edit] and post his mistake.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.