Skip to content

Instantly share code, notes, and snippets.

@GreyHat147
Created November 4, 2017 14:12
Show Gist options
  • Save GreyHat147/e8cc90fe32da6f753cfd5a126c1c48d0 to your computer and use it in GitHub Desktop.
Save GreyHat147/e8cc90fe32da6f753cfd5a126c1c48d0 to your computer and use it in GitHub Desktop.
sql
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