Skip to content

Instantly share code, notes, and snippets.

@GreyHat147
Created February 17, 2018 03:48
Show Gist options
  • Save GreyHat147/618a8e9ce8a7045888b3bc608fb55df9 to your computer and use it in GitHub Desktop.
Save GreyHat147/618a8e9ce8a7045888b3bc608fb55df9 to your computer and use it in GitHub Desktop.
mysql
CREATE DATABASE Concesionario;
CREATE TABLE auto (
matricula int,
marca varchar(30),
modelo varchar(30),
color varchar(30),
primary key(matricula)
);
CREATE TABLE cliente(
NIF int,
nombre varchar(30),
direccion varchar(30),
ciudad varchar(30),
telefono varchar(30),
autoId int,
primary key (NIF),
foreign key (autoId) references auto(matricula)
);
CREATE TABLE revision (
filtro varchar(30),
aceite varchar(30),
frenos varchar(30),
cliente_id int,
foreign key (cliente_id) references cliente(NIF)
);
INSERT INTO auto values(9999, "Mercedez", "GGG-300", "Negro");
INSERT INTO auto values(1234, "BMW", "GGG-500", "Gris");
INSERT INTO cliente values(234, "Carlos Rojas", "Calle 26", "Bogota", "234567890", 9999);
INSERT INTO cliente values(321, "Laura Rojas", "Carrera 32", "Medellin", "234567890", 1234);
INSERT INTO revision values("Martes", "Domingo", "Lunes", 234);
INSERT INTO revision values("Miercoles", "Jueves", "Viernes", 321);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment