CREATE TABLE adherents(
numadh INTEGER NOT NULL,
sexeadh CHAR DEFAULT 'H',
civiliteadh VARCHAR (4) DEFAULT 'M',
nomadh VARCHAR (25) NOT NULL,
prenomadh VARCHAR (25) NOT NULL,
adradh VARCHAR (60) NOT NULL,
cpadhdh CHAR (5) NOT NULL DEFAULT '91540',
villeadh VARCHAR (50) NOT NULL DEFAULT 'Mennecy',
PRIMARY KEY (NumAdh)
);
use clubtennis;
CREATE TABLE inscriptions (
numadh integer not null,
numlecon integer not null,
PRIMARY KEY (numadh, numlecon),
FOREIGN KEY (numlecon) REFERENCES lecon(numlecon),
FOREIGN KEY (numadh) REFERENCES adherents(numadh)
);
CREATE TABLE lecon (
numlecon varchar(3),
niveaulecon char(1),
jouerlecon boolean,
debutlecon time,
finlecon time,
PRIMARY KEY (numlecon)
) ;
SELECT nomadh, prenomadh
FROM adherents, cotisations
WHERE (adherents.numadh=cotisations.numadh
AND cotreglee=FALSE
);
SELECT count(numadh) as effectifcours
FROM inscriptions, lecon
WHERE inscriptions.numlecon=lecon.numlecon
GROUP BY niveaulecon;
ALTER TABLE lecon
ADD dateinscription date;
ALTER TABLE cotisations
DROP anneecot;
ALTER TABLE cotisations
ADD anneescolaire char(9);
ALTER TABLE cotisations
DROP cotreglee;
ALTER TABLE cotisations
ADD datereglementcot date;
ALTER TABLE lecon
ADD dirigeant varchar(30);
INSERT INTO adherents
VALUES ('1','H','Monsieur','DUPOND','Marc','1 rue de la liberation','44200','NANTES');
INSERT INTO adherents
VALUES ('2','F','Mademoiselle','DUPOND','Anne','1 rue de la liberation','44200','NANTES');
INSERT INTO adherents
VALUES ('3','F','Madame','DUPOND','Sandrine','1 rue de la liberation','44200','NANTES');
INSERT INTO adherents
VALUES ('4','H','Monsieur','MORIN','Hervé','44 rue Saint Denis','35000','RENNES');
INSERT INTO adherents
VALUES ('5','F','Mademoiselle','GAGNERON','Aurélie','4 rue Laënnec','35700','RENNES');
INSERT INTO adherents
VALUES ('11','F','Madame','DULLAC','Martine','4 allée André Marlaux ','35150','CORPS NUDS');
INSERT INTO adherents
VALUES ('6','F','Madame','DUPRE','STEPHANIE','87 rue Ernest Renan','35480','GUIPRY');
INSERT INTO adherents
VALUES ('7','H','Monsieur','BRIGAND','Maurice','2 rue Louis Blériot','35360','MONTAUBAN');
INSERT INTO adherents
VALUES ('8','H','Monsieur','VAN ELIT','Gérard','27 rue Ambroise','35170','BRUZ');
INSERT INTO adherents
VALUES ('9','H','Monsieur','DESROSIERS','Antoine','2 allée antoinette','35520','GUICHEN');
INSERT INTO adherents
VALUES ('10','F','Mademoiselle','DUMAS','Sandrine','5 allée des tilleuls','35830','BETTON');
INSERT INTO cotisations
VALUES ('1','2010','25','oui','1');
INSERT INTO cotisations
VALUES ('2','2010','100','oui','2');
INSERT INTO cotisations
VALUES ('3','2010','100','oui','3');
INSERT INTO cotisations
VALUES ('4','2010','110','non','5');
INSERT INTO cotisations
VALUES ('5','2010','100','oui','5');
INSERT INTO cotisations
VALUES ('6','2010','100','non','6');
INSERT INTO cotisations
VALUES ('7','2010','60','oui','4');
INSERT INTO cotisations
VALUES ('8','2010','100','oui','2');
INSERT INTO cotisations
VALUES ('9','2010','150','oui','7');
INSERT INTO cotisations
VALUES ('10','2010','80','non','8');
INSERT INTO cotisations
VALUES ('11','2010','200','oui','9');
INSERT INTO cotisations
VALUES ('13','2010','100','oui','10');
INSERT INTO lecon
VALUES ('1','1',true,'2011-10-10 15:00:00','2011-10-10 17-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('2','1',false,'2011-11-10 15:00:00','2011-11-10 17-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('3','2',false,'2011-11-10 14:00:00','2011-11-10 16-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('4','2',false,'2011-11-20 08:00:00','2011-11-10 12-00-00','2011-09-11','yves fleuri');
INSERT INTO lecon
VALUES ('5','3',false,'2011-11-21 09:00:00','2011-11-10 12-00-00','20111-09-11','yves fleuri');
INSERT INTO lecon
VALUES ('6','3',false,'2011-11-21 09:00:00','2011-11-10 10-00-00','2011-09-11','dupond marc');
INSERT INTO lecon
VALUES ('7','1',true,'2011-12-10 15:00:00','2011-10-10 17-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('8','3',false,'2011-12-11 15:00:00','2011-11-11 17-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('9','4',false,'2011-11-15 14:00:00','2011-11-15 16-00-00','2011-09-11','yannick poilou');
INSERT INTO lecon
VALUES ('10','4',false,'2011-11-20 08:00:00','2011-11-20 12-00-00','2011-09-11','yves fleuri');
INSERT INTO lecon
VALUES ('11','2',false,'2011-11-21 09:00:00','2011-11-21 12-00-00','2011-09-11','yves fleuri');
INSERT INTO lecon
VALUES ('12','2',false,'2011-11-21 09:00:00','2011-11-21 10-00-00','2011-09-11','dupond marc');
INSERT INTO inscriptions
VALUES ('1','1');
INSERT INTO inscriptions
VALUES ('1','2');
INSERT INTO inscriptions
VALUES ('2','1');
INSERT INTO inscriptions
VALUES ('3','1');
INSERT INTO inscriptions
VALUES ('4','4');
INSERT INTO inscriptions
VALUES ('4','1');
INSERT INTO inscriptions
VALUES ('5','1');
INSERT INTO inscriptions
VALUES ('6','2');
INSERT INTO inscriptions
VALUES ('7','1');
INSERT INTO inscriptions
VALUES ('8','7');
INSERT INTO inscriptions
VALUES ('9','1');
INSERT INTO inscriptions
VALUES ('10','1');
INSERT INTO inscriptions
VALUES ('10','2');
INSERT INTO inscriptions
VALUES ('11','3');
INSERT INTO inscriptions
VALUES ('10','8');
INSERT INTO inscriptions
VALUES ('10','10');
CREATE VIEW adh2010(numadh, nomadh, prenomadh, cotreglee, anneecot)
AS SELECT adherents.numadh, nomadh, prenomadh,cotreglee, anneecot
FROM cotisations, adherents
WHERE cotisations.numadh=adherents.numadh
AND cotreglee='true'
AND anneecot='2010';
En fait ta requête de création de vue ne va rien sélectionner car dans le champ cotreglee tu inseres des valeurs 'oui' et 'non' et tu fais ta requetes de création de vue sur cotreglee = 'true' au lieu de cotreglee = 'oui'.
Obtenez des réponses à vos questions sur la gestion de données, partagez des astuces et restez à jour avec les dernières avancées technologiques en matière de stockage de données.