Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Evaluacion SQLBrayan Felipe Medina
Evaluacion SQLBrayan Felipe Medina
)ENGINE =INNODB;
#Creando tabla editorial con los datos basicos de la editorial
CREATE TABLE IF NOT EXISTS editorial(
id_editorial INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
nombre VARCHAR (100) NOT NULL,
pais VARCHAR(20) NOT NULL,
email VARCHAR(50) NOT NULL UNIQUE
)ENGINE =INNODB;
#Creando tabla libros que contiene sus determinados libros, hereda el id de
editorial
CREATE TABLE IF NOT EXISTS libros (
#SOLO TOMA VALORES POSITIVOS CON LA INSTRUCCION UNSIGNED
id_libro INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
titulo VARCHAR (60) NOT NULL,
autor VARCHAR(100) NOT NULL,
editorial_id_editorial INTEGER UNSIGNED NOT NULL,
CONSTRAINT fkeditorial_libros_id_editorial
FOREIGN KEY (editorial_id_editorial)
REFERENCES editorial(id_editorial),
precio DECIMAL(5,2),
unidades_disponibles INTEGER (10)
)ENGINE =INNODB;
)ENGINE =INNODB;
//describiendo las ventas
describe editorial;
describe libros;
describe usuario;
describe ventas;