CREATE TABLE usuario (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
nombre varchar(50) NOT NULL,
paterno varchar(50) NOT NULL,
materno varchar(50) NOT NULL
) ENGINE=INNODB;
CREATE TABLE articulos (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
titulo varchar(50) NOT NULL,
imagen varchar(150) NOT NULL,
contenido TEXT NOT NULL,
usuario_id INT,
INDEX par_ind (usuario_id),
CONSTRAINT fk_usuario FOREIGN KEY (usuario_id)
REFERENCES usuario(id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=INNODB;
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.