Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 26, 2021 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/d96ebd77d2f06282f62456c7a8059658 to your computer and use it in GitHub Desktop.
Save parzibyte/d96ebd77d2f06282f62456c7a8059658 to your computer and use it in GitHub Desktop.
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