-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInnoDB-schema.sql
executable file
·35 lines (30 loc) · 974 Bytes
/
InnoDB-schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
DROP SCHEMA IF EXISTS CorteIngles;
CREATE SCHEMA CorteIngles;
USE CorteIngles;
CREATE TABLE producto (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
nombre VARCHAR(50) NOT NULL,
precio INT NOT NULL,
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE cliente (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
nombre VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE sucursal (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ciudad VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE venta (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
cantidad INT,
producto_id INT UNSIGNED NOT NULL,
cliente_id INT UNSIGNED NOT NULL,
sucursal_id INT UNSIGNED NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (producto_id) REFERENCES producto (id),
FOREIGN KEY (sucursal_id) REFERENCES sucursal (id),
FOREIGN KEY (cliente_id) REFERENCES cliente (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;