Answers for "foreign key type uniqu mysql"

SQL
3

how to connect database foreign key in mysql

CREATE TABLE products(
    productId INT AUTO_INCREMENT PRIMARY KEY,
    productName varchar(100) not null,
    categoryId INT NOT NULL,
    CONSTRAINT fk_category
    FOREIGN KEY (categoryId) 
    REFERENCES categories(categoryId)
        ON UPDATE CASCADE
        ON DELETE CASCADE
) ENGINE=INNODB;
Posted by: Guest on August-20-2020
0

foreign key type uniqu mysql

mysql > create unique index index_bar_id on foos(bar_id);
mysql > alter table foos add constraint index_bar_id foreign key (bar_id) references bars (id);
Posted by: Guest on October-16-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language