Created
November 4, 2017 14:12
-
-
Save GreyHat147/e8cc90fe32da6f753cfd5a126c1c48d0 to your computer and use it in GitHub Desktop.
sql
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 DATABASE Tienda; | |
CREATE TABLE FABRICANTES | |
( | |
clave_fabricante int, | |
nombre varchar(30), | |
primary key(clave_fabricante) | |
); | |
CREATE TABLE ARTICULOS | |
( | |
clave_articulo int, | |
nombre varchar(30), | |
precio int, | |
clave int, | |
primary key(clave_articulo) | |
); | |
ALTER TABLE ARTICULOS ADD FOREIGN KEY (clave) REFERENCES FABRICANTES(clave_fabricante); | |
INSERT INTO FABRICANTES VALUES (1,'Kingston'); | |
INSERT INTO FABRICANTES VALUES (2,'Adata'); | |
INSERT INTO FABRICANTES VALUES (3,'Logitech'); | |
INSERT INTO FABRICANTES VALUES (4,'Lexar'); | |
INSERT INTO FABRICANTES VALUES (5,'Seagate'); | |
INSERT INTO ARTICULOS VALUES (1,'Teclado',20000,3); | |
INSERT INTO ARTICULOS VALUES (2,'Disco duro',5000,5); | |
INSERT INTO ARTICULOS VALUES (3,'Mouse',3500,3); | |
INSERT INTO ARTICULOS VALUES (4,'Memoria USB',20000,4); | |
INSERT INTO ARTICULOS VALUES (5,'Memoria RAM',20000,1); | |
INSERT INTO ARTICULOS VALUES (6,'Disco duro 250',20000,5); | |
INSERT INTO ARTICULOS VALUES (7,'Memoria USB',20000,1); | |
INSERT INTO ARTICULOS VALUES (8,'DVD ROM',20000,2); | |
INSERT INTO ARTICULOS VALUES (9,'CD ROM',20000,2); | |
INSERT INTO ARTICULOS VALUES (10,'Tarjeta de video',20000,3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment