Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created Apr 26, 2021
Embed
What would you like to do?
CREATE TABLE IF NOT EXISTS clientes(
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
nombre VARCHAR(255) NOT NULL,
departamento VARCHAR(255) NOT NULL,
edad INT NOT NULL,
fecha_registro VARCHAR(10) NOT NULL
);
CREATE TABLE IF NOT EXISTS ventas_clientes(
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_cliente BIGINT UNSIGNED NOT NULL,
monto DECIMAL(9,2) NOT NULL,
fecha VARCHAR(10) NOT NULL,
FOREIGN KEY (id_cliente) REFERENCES clientes(id) ON UPDATE CASCADE ON DELETE CASCADE
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment