Created
April 23, 2014 18:12
-
-
Save xerardoo/11226648 to your computer and use it in GitHub Desktop.
DB Cliente_Orden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Cliente ( | |
idCliente INT NOT NULL, | |
nombre VARCHAR(25) NOT NULL, | |
apPaterno VARCHAR(25) NOT NULL, | |
apMaterno VARCHAR(25) NOT NULL, | |
rfc VARCHAR(25) NOT NULL, | |
direccion VARCHAR(25) NOT NULL, | |
telefono VARCHAR(15) NOT NULL, | |
CONSTRAINT idCliente PRIMARY KEY (idCliente) | |
) | |
CREATE TABLE Orden ( | |
idOrden INT NOT NULL, | |
idClienteFK INT NOT NULL, | |
producto VARCHAR(25) NOT NULL, | |
cantidad INT NOT NULL, | |
precio REAL NOT NULL, | |
fecha DATETIME NOT NULL, | |
CONSTRAINT idOrden PRIMARY KEY (idOrden) | |
) | |
ALTER TABLE Orden ADD CONSTRAINT Cliente_Orden_fk | |
FOREIGN KEY (idClienteFK) | |
REFERENCES Cliente (idCliente) | |
ON DELETE CASCADE | |
ON UPDATE CASCADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment