CREATE DATABASE automoviles;
|
|
|
|
USE automoviles;
|
|
|
|
DROP TABLE IF EXISTS carburante;
|
|
|
|
CREATE TABLE carburante (
|
|
fecha date DEFAULT NULL,
|
|
vehiculo int(11) DEFAULT NULL,
|
|
kms int(11) DEFAULT NULL,
|
|
litros decimal(10,3) DEFAULT NULL,
|
|
descuento decimal(10,2) DEFAULT NULL,
|
|
precioxlitro decimal(10,3) DEFAULT NULL,
|
|
importe decimal(10,2) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
|
|
|
|
|
|
DROP TABLE IF EXISTS vehiculos;
|
|
|
|
CREATE TABLE vehiculos (
|
|
identificador int(11) NOT NULL,
|
|
marca text NOT NULL,
|
|
modelo text NOT NULL,
|
|
matricula text NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
|
|
ALTER TABLE vehiculos
|
|
ADD PRIMARY KEY (identificador);
|
|
|
|
|
|
ALTER TABLE vehiculos
|
|
MODIFY identificador int(11) NOT NULL AUTO_INCREMENT;
|
|
COMMIT;
|
|
|
|
|