USE fip1bdd; −− Sélectionne la base de données

DROP TABLE Spectacle; −− supprime les tables si elles existaient déjà
DROP TABLE Client;
DROP TABLE Reservation;

CREATE TABLE Spectacle (id_spectacle INT NOT NULL PRIMARY KEY,
  places_offertes INT NOT NULL,
  places_libres INT NOT NULL,
  tarif DECIMAL(10,2) NOT NULL
) ENGINE=InnoDB;

CREATE TABLE Client (id_client INT NOT NULL PRIMARY KEY,
  Solde FLOAT NOT NULL
) ENGINE=InnoDB;

CREATE TABLE Reservation (id_client INT NOT NULL,
  id_spectacle INT NOT NULL,
  places_reservees INT NOT NULL,
  PRIMARY KEY (id_client, id_spectacle),
  KEY spectacle (id_spectacle)
) ENGINE=InnoDB;
