Projet BD Oster Luca

an anonymous user · April 08, 2021 · SQL
-- créer une table
CREATE TABLE sites (
  id_site INTEGER PRIMARY KEY,
  nom TEXT NOT NULL,
  ville TEXT NOT NULL
);
CREATE TABLE vehicules (
  id_vehicule INTEGER PRIMARY KEY,
  couleur TEXT NOT NULL,
  date_debut DATE NOT NULL,
  date_fin DATE NOT NULL,
  id_modele INTEGER
);
CREATE TABLE loueurs (
  id_loueur INTEGER PRIMARY KEY,
  nom TEXT NOT NULL,
  date_naissance DATE NOT NULL,
  num_permis TEXT NOT NULL
);
CREATE TABLE modeles (
  id_modele INTEGER PRIMARY KEY,
  nom_modele TEXT NOT NULL,
  motorisation TEXT NOT NULL,
  poids INTEGER NOT NULL,
  volume INTEGER NOT NULL,
  nb_places INTEGER NOT NULL,
  id_constructeur INTEGER,
  id_type INTEGER
);
CREATE TABLE constructeurs (
  id_constructeur INTEGER PRIMARY KEY,
  nom_marque TEXT NOT NULL
);
CREATE TABLE types (
  id_type INTEGER PRIMARY KEY,
  nom_type TEXT NOT NULL
);
CREATE TABLE heberger (
  id_heberger INTEGER PRIMARY KEY,
  date_debut DATE NOT NULL,
  date_fin DATE NOT NULL,
  id_vehicule INTEGER,
  id_site INTEGER
);
CREATE TABLE reserver (
  id_reserver INTEGER PRIMARY KEY,
  date_debut DATE NOT NULL,
  date_fin DATE NOT NULL,
  id_vehicule INTEGER,
  id_loueur INTEGER
);

-- insert some values
INSERT INTO students VALUES (1, 'Ryan', 'M');
INSERT INTO students VALUES (2, 'Joanna', 'F');
-- fetch some values
SELECT * FROM students WHERE gender = 'F';

Comments

Please sign up or log in to contribute to the discussion.