Upload
adelie-courtois
View
112
Download
5
Embed Size (px)
Citation preview
Club de tennis
–
Création de la base de données
Correction
COTISATION
NumR_CotAnnee_CotMonta_CotRegle_CotNumer_Adh
ADHERENT
NumR_AdhSexe_AdhCivil_AdhNom_AdhPreno_AdhAdres_AdhCP_AdhVille_Adh
INSCRIPTION
NumR_AdhNumR_Leçon
LECON
NumeroLeçonNiveauLeçonJourLeçonDébutLeçonFinLeçon
∞
∞ ∞
11
1
Les types de données
Type de données
Type SQL Description
Alphanumérique Char (n) Chaîne de caractères de longueur fixe n
Alphanumérique Varchar (n) Chaîne de caractères de n car maximum
Numérique smallint Entiers de 16 bits (-32768 et 32767)
Numérique integer Entiers de 32 bits
Numérique Number (n,d) Nb de n chiffres (d après la virgule)
Date / heure date Date ss la forme 16/07/99
Date / heure time heure ss la forme 12:54:24,85
Date / heure timstamp Date et heure
CREATE TABLE Adherent(NumAdh integer Not Null Autoinc,SexeAdh Varchar(1) Not Null Default ‘H’,CiviliteAdh Varchar(12) Not Null Default ‘Monsieur’,NomAdh Varchar(30) Not Null,PrenomAdh Varchar(30) Not Null,AdrAdh Varchar(100) Not Null,CpAdh integer Not Null Default ‘91540’,VilleAdh Varchar(30) Not Null,PRIMARY KEY (NumAdh));
Requête de création de la table Adhérent
CREATE TABLE Cotisation
(NumCot integer Not Null Autoinc,
AnneCot Smallint Default Year(Current_Date),
MontantCot number(3,2),
RegltCot Boolean,
NumAdh integer,
PRIMARY KEY (NumCot),
FOREIGN KEY NumAdh REFERENCES Adherent(NumAdh)
);
Requête de création de la table Cotisation
CREATE TABLE Leçon
(NumLeçon smallint Not Null Autoinc,
NiveauLeçon Varchar(10),
JourLeçon Date Not Null,
DebutLeçon Time Not Null,
FinLeçon Time Not Null,
PRIMARY KEY (NumLeçon),
);
Requête de création de la table Leçon
CREATE TABLE Inscription
(NumAdh integer Not Null,
NumLeçon smallint,
PRIMARY KEY (NumAdh ,NumLeçon),
FOREIGN KEY NumAdh REFERENCES Adherent(NumAdh),
FOREIGN KEY NumLeçon REFERENCES Leçon(NumLeçon)
);
Requête de création de la table Inscription
SELECT NomAdh, PrenomAdh
FROM Adherent, Cotisation
WHERE Adherent.NumAdh = Cotisation.NumAdh
AND ReglCot = False;
Noms et prénoms des licenciés n’ayant pas encore réglé leur cotisation.
SELECT NiveauLeçon, COUNT(NumAdh) AS Effectif
FROM Inscription, Leçon
WHERE Leçon.NumLeçon = Inscription.NumLeçon
GROUP BY NiveauLeçon;
Nb de licenciés par niveau de tennis (compétition, confirmé, intermédiaire et débutant).