Code :
CREATE TABLE gi_categorie (id integer NOT NULL PRIMARY KEY, nom varchar(50) NOT NULL) go CREATE TABLE gi_intervention (id integer NOT NULL PRIMARY KEY, date datetime NOT NULL, cat_id integer NOT NULL REFERENCES gi_categorie(id)) go INSERT INTO gi_categorie (id, nom) VALUES (1, 'Cat 1'); INSERT INTO gi_categorie (id, nom) VALUES (2, 'Cat 2'); INSERT INTO gi_categorie (id, nom) VALUES (3, 'Cat 3'); INSERT INTO gi_intervention (id, date, cat_id) VALUES (1, '2008-01-01', 1); INSERT INTO gi_intervention (id, date, cat_id) VALUES (2, '2008-01-02', 2); INSERT INTO gi_intervention (id, date, cat_id) VALUES (3, '2008-02-02', 3); INSERT INTO gi_intervention (id, date, cat_id) VALUES (4, '2008-02-02', 1); INSERT INTO gi_intervention (id, date, cat_id) VALUES (5, '2008-02-02', 1); INSERT INTO gi_intervention (id, date, cat_id) VALUES (6, '2008-02-10', 2); INSERT INTO gi_intervention (id, date, cat_id) VALUES (7, '2008-02-11', 3); INSERT INTO gi_intervention (id, date, cat_id) VALUES (8, '2008-02-11', 2);
|