L3 Info : SGBD
 
◃  Ch. 10 PL/pgSQL  ▹
 

Exemples sur la table outlaw

  • Table et données utilisées :
    CREATE TABLE outlaw (
      ol_id SERIAL PRIMARY KEY, 
      ol_nom VARCHAR(30) NOT NULL,
      ol_prenom VARCHAR(30) NOT NULL,
      ol_naissance DATE NOT NULL);
    
    INSERT INTO outlaw(ol_nom,ol_prenom,ol_naissance) SELECT etud_nom, etud_prenom, etud_naissance FROM etudiant WHERE etud_nom = 'Dalton';
    
    SELECT * FROM outlaw;
     ol_id | ol_nom | ol_prenom | ol_naissance 
    -------+--------+-----------+--------------
         1 | Dalton | Joe       | 1865-04-01
         2 | Dalton | Jack      | 1866-07-04
         3 | Dalton | William   | 1867-11-28
         4 | Dalton | Averell   | 1868-12-25
    (4 rows)
  • 4 exemples :
    • Réaction avant chaque insertion de ligne
    • Réaction après toutes les insertions
    • Réaction annulant les insertions
    • Réaction modifiant les insertions