

CREATE TABLE veiculos (
  id INT PRIMARY KEY AUTO_INCREMENT,
  modelo VARCHAR(50) NOT NULL,
  marca VARCHAR(50) NOT NULL,
  ano INT NOT NULL,
  cor VARCHAR(50) NOT NULL,
  placa VARCHAR(50) NOT NULL,
  disponivel BOOLEAN NOT NULL DEFAULT TRUE
);

CREATE TABLE reservas (
  id INT PRIMARY KEY AUTO_INCREMENT,
  id_usuario INT NOT NULL,
  id_veiculo INT NOT NULL,
  data_inicio DATETIME NOT NULL,
  data_fim DATETIME NOT NULL,
  FOREIGN KEY (id_usuario) REFERENCES usuarios(id),
  FOREIGN KEY (id_veiculo) REFERENCES veiculos(id)
);

INSERT INTO veiculos (modelo, marca, ano, cor, placa, disponivel)
VALUES 
  ('Civic', 'Honda', 2021, 'Preto', 'ABC1234', TRUE),
  ('Onix', 'Chevrolet', 2022, 'Branco', 'DEF5678', TRUE);

INSERT INTO reservas (id_usuario, id_veiculo, data_inicio, data_fim)
VALUES 
  (1, 1, '2023-04-20 09:00:00', '2023-04-22 17:00:00'),
  (2, 2, '2023-04-23 14:00:00', '2023-04-24 12:00:00');


