# chekin 3 Banco de dados Para fazermos um um relacionamento entre tabelas usamos o comando FOREIGN KEY (COLOCAMOS O ID_NOME) REFERENCES tb_nome_tabela (id_filme) Exemplo de tabela: `````sql= CREATE TABLE tb_categoria ( id_categoria int primary key auto_increment, nm_categoria varchar(100) ); CREATE TABLE tb_produto ( id_produto int primary key auto_increment, id_categoria int, nm_produto varchar(255), vl_preco decimal (15,2), foreign key (id_categoria) REFERENCES tb_categoria (id_categoria) on delete cascade ); ``````
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up