Corrigés des exercices SQL pour MySQL
|
|
|
- Frederica McCormick
- 10 years ago
- Views:
Transcription
1 Corrigés des exercices SQL pour MySQL Christian Soutou Eyrolles 2006 Chapitre 1 Création des tables CREATE TABLE Segment (indip varchar(11), nomsegment varchar(20) NOT NULL, etage TINYINT(1), CONSTRAINT pk_segment PRIMARY KEY (indip)); CREATE TABLE Salle (nsalle varchar(7), nomsalle varchar(20) NOT NULL, nbposte TINYINT(2), indip varchar(11), CONSTRAINT pk_salle PRIMARY KEY (nsalle)); CREATE TABLE Poste (nposte varchar(7), nomposte varchar(20) NOT NULL, indip varchar(11), ad varchar(3), typeposte varchar(9), nsalle varchar(7), CONSTRAINT pk_poste PRIMARY KEY (nposte), CONSTRAINT ck_ad CHECK (ad BETWEEN '000' AND '255')); CREATE TABLE Logiciel (nlog varchar(5), nomlog varchar(20) NOT NULL, dateach DATETIME, version varchar(7), typelog varchar(9), prix DECIMAL(6,2), CONSTRAINT pk_logiciel PRIMARY KEY (nlog), CONSTRAINT ck_prix CHECK (prix >= 0)); CREATE TABLE Installer (nposte varchar(7), nlog varchar(5), numins INTEGER(5) AUTO_INCREMENT, dateins TIMESTAMP DEFAULT NOW(), delai DECIMAL(8,2), CONSTRAINT pk_installer PRIMARY KEY(numIns)); CREATE TABLE Types (typelp varchar(9), nomtype varchar(20), CONSTRAINT pk_types PRIMARY KEY(typeLP)); Destruction des tables Chapitre 2 DROP TABLE Installer; DROP TABLE Logiciel; DROP TABLE Poste; DROP TABLE Types; DROP TABLE Salle; DROP TABLE Segment; Insertion des données INSERT INTO Segment VALUES (' ','Brin RDC',NULL);
2 Corrigés des exos 11 INSERT INTO Segment VALUES (' ','Brin 1er étage',null); INSERT INTO Segment VALUES (' ','Brin 2ème étage',null); INSERT INTO Salle VALUES ('s01','salle 1',3,' '); INSERT INTO Salle VALUES ('s02','salle 2',2,' '); INSERT INTO Salle VALUES ('s03','salle 3',2,' '); INSERT INTO Salle VALUES ('s11','salle 11',2,' '); INSERT INTO Salle VALUES ('s12','salle 12',1,' '); INSERT INTO Salle VALUES ('s21','salle 21',2,' '); INSERT INTO Salle VALUES ('s22','salle 22',0,' '); INSERT INTO Salle VALUES ('s23','salle 23',0,' '); INSERT INTO poste VALUES ('p1','poste 1',' ','01','TX','s01'); INSERT INTO poste VALUES ('p2','poste 2',' ','02','UNIX','s01'); INSERT INTO poste VALUES ('p3','poste 3',' ','03','TX','s01'); INSERT INTO poste VALUES ('p4','poste 4',' ','04','PCWS','s02'); INSERT INTO poste VALUES ('p5','poste 5',' ','05','PCWS','s02'); INSERT INTO poste VALUES ('p6','poste 6',' ','06','UNIX','s03'); INSERT INTO poste VALUES ('p7','poste 7',' ','07','TX','s03'); INSERT INTO poste VALUES ('p8','poste 8',' ','01','UNIX','s11'); INSERT INTO poste VALUES ('p9','poste 9',' ','02','TX','s11'); INSERT INTO poste VALUES ('p10','poste 10',' ','03','UNIX','s12'); INSERT INTO poste VALUES ('p11','poste 11',' ','01','PCNT','s21'); INSERT INTO poste VALUES ('p12','poste 12',' ','02','PCWS','s21'); INSERT INTO logiciel VALUES ('log1','oracle 6', ' ','6.2','UNIX',3000); INSERT INTO logiciel VALUES ('log2','oracle 8', ' ','8i','UNIX',5600); INSERT INTO logiciel VALUES ('log3','sql Server', ' ','7','PCNT',3000); INSERT INTO logiciel VALUES ('log4','front Page', ' ','5','PCWS',500); INSERT INTO logiciel VALUES ('log5','windev', ' ','5','PCWS',750); INSERT INTO logiciel VALUES ('log6','sql*net', NULL, '2.0','UNIX',500); INSERT INTO logiciel VALUES ('log7','i. I. S.', ' ','2','PCNT',900); INSERT INTO logiciel VALUES ('log8','dreamweaver',' ','2.0','beos',1400); INSERT INTO Types VALUES ('TX', 'Terminal X-Window'); INSERT INTO Types VALUES ('UNIX','Système Unix'); INSERT INTO Types VALUES ('PCNT','PC Windows NT'); INSERT INTO Types VALUES ('PCWS','PC Windows'); INSERT INTO Types VALUES ('NC', 'Network Computer'); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p2', 'log1', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p2', 'log2', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p4', 'log5', NULL,NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p6', 'log6', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p6', 'log1', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p8', 'log2', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p8', 'log6', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p11','log3', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p12','log4', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p11','log7', ' ',NULL); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p7', 'log7', ' ',NULL); Modification des données UPDATE Segment SET etage=0 WHERE indip = ' '; UPDATE Segment SET etage=1 WHERE indip = ' '; UPDATE Segment SET etage=2 WHERE indip = ' '; SELECT * FROM Segment; UPDATE Logiciel SET prix = prix*0.9 WHERE typelog = 'PCNT'; SELECT nlog, typelog, prix FROM Logiciel;
3 12 Corrigés des exos Chapitre 3 Ajout de colonnes ALTER TABLE Segment ADD (nbsalle TINYINT(2) DEFAULT 0, nbposte TINYINT(2) DEFAULT 0); ALTER TABLE Logiciel ADD nbinstall TINYINT(2) DEFAULT 0; ALTER TABLE Poste ADD nblog TINYINT(2) DEFAULT 0; Modification de colonnes ALTER TABLE Salle MODIFY nomsalle VARCHAR(30); DESC Salle; ALTER TABLE Segment MODIFY nomsegment VARCHAR(15); DESC Segment; Ajout de contraintes ALTER TABLE Installer ADD CONSTRAINT un_installation UNIQUE(nPoste,nLog); ALTER TABLE Poste ADD CONSTRAINT fk_poste_indip_segment FOREIGN KEY(indIP) REFERENCES Segment(indIP); ALTER TABLE Poste ADD CONSTRAINT fk_poste_nsalle_salle FOREIGN KEY(nSalle) REFERENCES Salle(nSalle); ALTER TABLE Poste ADD CONSTRAINT fk_poste_typeposte_types FOREIGN KEY(typePoste) REFERENCES Types(typeLP); ALTER TABLE Installer ADD CONSTRAINT fk_installer_nposte_poste FOREIGN KEY(nPoste) REFERENCES Poste(nPoste); ALTER TABLE Installer ADD CONSTRAINT fk_installer_nlog_logiciel FOREIGN KEY(nLog) REFERENCES Logiciel(nLog); -- commande refusées ALTER TABLE Logiciel ADD CONSTRAINT fk_logiciel_typelog_types FOREIGN KEY(typeLog) REFERENCES Types(typeLP); ALTER TABLE Salle ADD CONSTRAINT fk_salle_indip_segment FOREIGN KEY(indIP) REFERENCES Segment(indIP); --erreurs : SELECT nlog FROM Logiciel WHERE typelog NOT IN (SELECT typelp FROM Types); SELECT nsalle FROM Salle WHERE indip NOT IN (SELECT indip FROM Segment); --résolution des rejets --Supprimer les enregistrements de la table Salle qui posent problème. DELETE FROM Salle WHERE indip NOT IN (SELECT indip FROM Segment); --Ajouter le type de logiciel ( BeOS, Système Be ) INSERT INTO Types VALUES ('BeOS','Système Be'); -- commandes OK ALTER TABLE Logiciel ADD CONSTRAINT fk_logiciel_typelog_types FOREIGN KEY(typeLog) REFERENCES Types(typeLP); ALTER TABLE Salle ADD CONSTRAINT fk_salle_indip_segment FOREIGN KEY(indIP) REFERENCES Segment(indIP); Chapitre 4 Création dynamique de tables CREATE TABLE Softs AS SELECT nomlog, Version, prix FROM Logiciel; ALTER TABLE Softs CHANGE nomlog nomsoft VARCHAR(20);
4 Corrigés des exos 13 CREATE TABLE PCSeuls AS SELECT nposte, nomposte, IndIP, ad, typeposte, nsalle FROM Poste WHERE typeposte = 'PCNT' OR typeposte = 'PCWS'; ALTER TABLE PCSeuls CHANGE nposte np VARCHAR(7); ALTER TABLE PCSeuls CHANGE nomposte nomp VARCHAR(20); ALTER TABLE PCSeuls CHANGE IndIP seg VARCHAR(11); ALTER TABLE PCSeuls CHANGE typeposte typep VARCHAR(9); ALTER TABLE PCSeuls CHANGE nsalle lieu VARCHAR(9); Requêtes monotables --1 Type du poste p8 SELECT nposte, typeposte FROM Poste WHERE nposte = 'p8'; --2 Noms des logiciels UNIX SELECT nomlog FROM Logiciel WHERE typelog = 'UNIX'; --3 Nom, adresse IP, numéro de salle des postes de type UNIX ou PCWS. SELECT nomposte, indip, ad, nsalle FROM poste WHERE typeposte = 'UNIX' OR typeposte = 'PCWS'; --4 Même requête pour les postes du segment triés --par numéro de salle décroissant SELECT nomposte, indip, ad, nsalle FROM poste WHERE (typeposte = 'UNIX' OR typeposte = 'PCWS') AND indip = ' ' ORDER BY nsalle DESC; --5 Numéros des logiciels installés sur le poste p6. SELECT nlog FROM Installer WHERE nposte = 'p6'; --6 Numéros des postes qui hébergent le logiciel log1. SELECT nposte FROM Installer WHERE nlog = 'log1'; --7 Nom et adresse IP complète (ex : ) des postes de type TX SELECT nomposte, CONCAT(indIP,'.',ad) FROM Poste WHERE typeposte = 'TX'; Fonctions et groupements --8 SELECT nposte, COUNT(nLog) FROM installer GROUP BY (nposte); --9 SELECT nsalle, COUNT(nPoste) FROM Poste GROUP BY (nsalle) ORDER BY 2; --10 SELECT nlog, COUNT(nPoste) FROM Installer GROUP BY (nlog); --11 SELECT AVG(prix) FROM Logiciel WHERE typelog = 'UNIX'; --12 SELECT MAX(dateAch) FROM Logiciel; --13 SELECT nposte FROM Installer GROUP BY nposte HAVING COUNT(nLog)=2; --14 SELECT COUNT(*) FROM (SELECT nposte FROM Installer GROUP BY nposte HAVING COUNT(nLog)=2) T; Requêtes multitables Opérateurs ensemblistes --15 SELECT DISTINCT typelp FROM Types WHERE typelp NOT IN (SELECT DISTINCT typeposte FROM Poste); --16
5 14 Corrigés des exos SELECT DISTINCT typelog FROM Logiciel WHERE typelog IN (SELECT typeposte FROM Poste); --17 SELECT DISTINCT typeposte FROM Poste WHERE typeposte NOT IN (SELECT typelog FROM Logiciel); Jointures procédurales --18 SELECT CONCAT(indIP,'.',ad) FROM Poste WHERE nposte IN (SELECT nposte FROM Installer WHERE nlog = 'log6'); --19 SELECT CONCAT(indIP,'.',ad) FROM Poste WHERE nposte IN (SELECT nposte FROM Installer WHERE nlog = (SELECT nlog FROM Logiciel WHERE nomlog = 'Oracle 8')); --20 SELECT nomsegment FROM Segment WHERE indip IN (SELECT indip FROM Poste WHERE typeposte = 'TX' GROUP BY indip HAVING COUNT(*)=3); --21 SELECT nomsalle FROM Salle WHERE nsalle IN (SELECT nsalle FROM Poste WHERE nposte IN (SELECT nposte FROM Installer WHERE nlog = (SELECT nlog FROM Logiciel WHERE nomlog = 'Oracle 6'))); --22 Nom du logiciel ayant la date d achat la plus récente (utiliser la requête 12). SELECT nomlog FROM Logiciel WHERE dateach = (SELECT MAX(dateAch) FROM Logiciel); Jointures relationnelles SELECT CONCAT(indIP,'.',ad) FROM Poste p, Installer i WHERE p.nposte = i.nposte AND i.nlog = 'log6'; --24 Adresse IP des postes qui hébergent le logiciel de nom Oracle 8 SELECT CONCAT(indIP,'.',ad) FROM Poste p, Installer i, Logiciel l WHERE p.nposte = i.nposte AND l.nlog = i.nlog AND l.nomlog = 'Oracle 8'; --25 Noms des segments possédant exactement trois postes de travail de type TX SELECT s.nomsegment FROM Segment s, Poste p WHERE s.indip = p.indip AND p.typeposte = 'TX' GROUP BY s.nomsegment HAVING COUNT(*)=3; --26 Noms des salles ou l on peut trouver au moins un poste hébergeant Oracle 6 SELECT s.nomsalle FROM Salle s, Poste p, Installer i, Logiciel l WHERE s.nsalle = p.nsalle AND p.nposte = i.nposte AND i.nlog = l.nlog AND l.nomlog = 'Oracle 6'; --27 SELECT sg.nomsegment, s.nsalle, p.indip '.' p.ad, l.nomlog, i.dateins FROM segment sg, Salle s, Poste p, Logiciel l, Installer i WHERE s.nsalle = p.nsalle AND s.indip = sg.indip AND p.nposte = i.nposte AND i.nlog = l.nlog ORDER BY 1,2,3; Jointures SQL Adresse IP des postes qui hébergent le logiciel log6. SELECT CONCAT(indIP,'.',ad) FROM Poste NATURAL JOIN Installer WHERE nlog = 'log6'; --29 Adresse IP des postes qui hébergent le logiciel de nom Oracle 8 SELECT CONCAT(indIP,'.',ad) FROM Poste NATURAL JOIN Installer NATURAL JOIN Logiciel WHERE nomlog = 'Oracle 8';
6 Corrigés des exos Noms des segments possédant exactement trois postes de travail de type TX SELECT nomsegment FROM Segment JOIN Poste USING(indIP) WHERE typeposte = 'TX' GROUP BY nomsegment HAVING COUNT(*)=3; --31 Noms des salles ou l on peut trouver au moins un poste hébergeant Oracle 6 SELECT nomsalle FROM Salle NATURAL JOIN Poste NATURAL JOIN Installer NATURAL JOIN Logiciel WHERE nomlog = 'Oracle 6'; Modifications synchronisées INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p2','log6',sysdate(),null); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p8','log1',sysdate(),null); INSERT INTO installer (nposte,nlog,dateins,delai) VALUES ('p10','log1',sysdate(),null); UPDATE Segment seg SET seg.nbsalle = (SELECT COUNT(*) FROM Salle sal WHERE seg.indip = sal.indip); UPDATE Segment seg SET seg.nbposte = (SELECT COUNT(*) FROM Poste pos WHERE seg.indip = pos.indip); UPDATE Logiciel l SET l.nbinstall = (SELECT COUNT(*) FROM Installer i WHERE l.nlog = i.nlog); UPDATE Poste p SET p.nblog = (SELECT COUNT(*) FROM Installer i WHERE p.nposte = i.nposte); Opérateurs existentiels Sous-interrogation synchronisée --32 SELECT nomposte FROM Poste p WHERE EXISTS (SELECT DISTINCT i1.nlog FROM Installer i1 WHERE i1.nposte = p.nposte AND i1.nlog IN ( SELECT i2.nlog FROM Installer i2 WHERE i2.nposte = 'p6') ) AND NOT (nposte ='p6'); Divisions --33 SELECT nomposte FROM Poste p WHERE NOT EXISTS (SELECT DISTINCT i2.nlog FROM Installer i2 WHERE i2.nposte = 'p6' AND i2.nlog NOT IN ( SELECT i1.nlog FROM Installer i1 WHERE i1.nposte = p.nposte)) AND NOT (nposte ='p6'); --34 SELECT nomposte FROM Poste p WHERE NOT EXISTS (SELECT i2.nlog FROM Installer i2 WHERE i2.nposte = 'p2' AND i2.nlog NOT IN (SELECT i1.nlog FROM Installer i1 WHERE i1.nposte = p.nposte)) AND NOT EXISTS (SELECT i1.nlog FROM Installer i1 WHERE i1.nposte = p.nposte AND i1.nlog NOT IN (SELECT i2.nlog FROM Installer i2 WHERE i2.nposte = 'p2')) AND NOT (nposte ='p2'); Chapitre 5 Vues monotables CREATE VIEW LogicielsUnix AS SELECT * FROM Logiciel WHERE typelog = 'UNIX'; DESCRIBE LogicielsUnix; SELECT * FROM LogicielsUnix;
7 16 Corrigés des exos CREATE VIEW Poste0 (npos0, nomposte0, nsalle0, TypePoste0, indip, ad0) AS SELECT nposte, nomposte, nsalle, typeposte, indip, ad FROM Poste WHERE indip IN (SELECT indip FROM Segment WHERE etage = 0); DESCRIBE Poste0; SELECT * FROM Poste0; INSERT INTO Poste0 VALUES ('p15','bidon15', 's01','unix',' ','20'); INSERT INTO Poste0 VALUES ('p16', 'Bidon16','s21','UNIX',' ','20'); -- les deux sont présents... SELECT * FROM Poste; -- seul le poste p15 est présent... SELECT * FROM Poste0; DELETE FROM Poste WHERE nposte IN ('p15','p16'); Résoudre une requête complexe CREATE VIEW SallePrix (nsalle, nomsalle, nbposte, prixlocation) AS SELECT nsalle, nomsalle, nbposte, nbposte*100 FROM Salle; SELECT * FROM SallePrix WHERE prixlocation > 150; ALTER TABLE Types DROP COLUMN tarif; ALTER TABLE Types ADD tarif SMALLINT(4); UPDATE Types SET tarif=50 WHERE typelp ='TX'; UPDATE Types SET tarif=100 WHERE typelp ='PCWS'; UPDATE Types SET tarif=120 WHERE typelp ='PCNT'; UPDATE Types SET tarif=200 WHERE typelp ='UNIX'; UPDATE Types SET tarif=80 WHERE typelp ='NC'; UPDATE Types SET tarif=400 WHERE typelp ='BeOS'; CREATE VIEW SalleIntermediaire(nSalle, typeposte, nombre, tarif) AS SELECT p.nsalle, p.typeposte, COUNT(p.nPoste), t.tarif FROM Poste p, Types t WHERE p.typeposte = t.typelp GROUP BY p.nsalle, p.typeposte, t.tarif; CREATE VIEW SallePrixTotal(nSalle, PrixReel) AS SELECT nsalle, SUM(nombre*tarif) FROM SalleIntermediaire GROUP BY nsalle; SELECT * FROM SallePrixTotal WHERE PrixReel = (SELECT MIN(PrixReel) FROM SallePrixTotal); Vues avec contraintes CREATE VIEW Poste0 (npos0, nomposte0, nsalle0, TypePoste0, indip, ad0) AS SELECT nposte, nomposte, nsalle, typeposte, indip, ad FROM Poste WHERE indip IN (SELECT indip FROM Segment WHERE etage = 0) WITH CHECK OPTION; --ck option failed INSERT INTO Poste0 VALUES('p16','Bidon15', 's21','unix',' ','20'); CREATE VIEW Installer0 (nposte, nlog, num, dateins) AS SELECT nposte, nlog, numins, dateins FROM Installer WHERE nlog NOT IN (SELECT nlog FROM Logiciel WHERE typelog = 'PCNT') AND nposte IN (SELECT nposte FROM Poste WHERE indip IN (SELECT indip FROM Segment WHERE etage=0 )) WITH CHECK OPTION ; --ck option failed INSERT INTO Installer0 (nposte,nlog,dateins) VALUES ('p11','log7',sysdate()); --ck option failed INSERT INTO Installer0 (nposte,nlog,dateins) VALUES ('p1','log7',sysdate()); --bonne installation INSERT INTO Installer0 (nposte,nlog,dateins) VALUES ('p6','log2',sysdate());
8 Corrigés des exos 17 Vue multitable CREATE VIEW SallePoste (nomsalle, nomposte, adrip, nomtypeposte) AS SELECT s.nomsalle, p.nomposte, CONCAT(p.indIP,'.',p.ad), t.nomtype FROM Salle s, Poste p, Types t WHERE s.nsalle = p.nsalle AND p.typeposte = t.typelp; Chapitre 6 Extraction de données delimiter DROP PROCEDURE sp1 CREATE PROCEDURE sp1() DECLARE v_sequenceinsmax INTEGER(5); DECLARE v_nposte VARCHAR(7); DECLARE v_nlog VARCHAR(5); DECLARE v_dateins TIMESTAMP; DECLARE v_nsalle VARCHAR(7); DECLARE v_nomlog VARCHAR(20); SELECT numins, nposte, nlog, dateins INTO v_sequenceinsmax, v_nposte, v_nlog, v_dateins FROM Installer WHERE numins = (SELECT MAX(numIns) FROM Installer); SELECT nsalle INTO v_nsalle FROM Poste WHERE nposte = v_nposte; SELECT nomlog INTO v_nomlog FROM Logiciel WHERE nlog = v_nlog; SELECT CONCAT('Derniere installation en salle : ',v_nsalle) "Resultat 1 exo 1"; SELECT CONCAT('Poste : ',v_nposte,' Logiciel : ', v_nomlog,' en date du ',v_dateins) "Resultat 2 exo 1"; --trace : CALL sp1() Variables de session Transaction delimiter = 's01' = 'UNIX' = '' = '' DROP PROCEDURE sp1 CREATE PROCEDURE sp1() SELECT COUNT(*) FROM Poste WHERE nsalle=@vs_nsalle AND typeposte=@vs_typeposte ; SELECT COUNT(*) FROM Installer WHERE nposte IN (SELECT nposte FROM Poste WHERE nsalle=@vs_nsalle AND typeposte=@vs_typeposte); --trace : CALL sp1() SELECT CONCAT(@vs_nbPoste, ' poste(s) installe(s) en salle ',@vs_nsalle,', ' installation(s) de type ',@vs_typeposte) "Resultat exo2" delimiter = 'log15' = 'MySQL Query' '1.4'
9 18 Corrigés des exos 'PCWS' = '95' DROP PROCEDURE sp1 CREATE PROCEDURE sp1() DECLARE v_nposte VARCHAR(7) DEFAULT 'p7'; DECLARE v_dateachat DATETIME; SET AUTOCOMMIT = 0; --Insère dans Logiciel INSERT INTO Logiciel VALUES (@vs_nlog,@vs_nomlog,now(),@vs_version,@vs_typelog,@vs_prix,0) ; SELECT('Logiciel insere dans la base') "message1"; --récupère la date de l'achat SELECT dateach INTO v_dateachat FROM Logiciel WHERE nlog SELECT CONCAT('Date achat : ',v_dateachat) "message2"; --On attend 5 petites secondes SELECT SLEEP(5); --Insère dans Installer SELECT CONCAT('Date installation : ',SYSDATE()) "message3"; INSERT INTO Installer (nposte,nlog,dateins,delai) VALUES SYSDATE(),TIMEDIFF(SYSDATE(),v_dateAchat)); SELECT('Logiciel installe sur le poste') "message4"; COMMIT; Chapitre 7 Curseur delimiter DROP TABLE IF EXISTS test.trace CREATE TABLE test.trace(message VARCHAR(80)) DROP PROCEDURE IF EXISTS calcultemps CREATE PROCEDURE calcultemps() DECLARE fincurs BOOLEAN DEFAULT 0; DECLARE v_nomlog VARCHAR(20); DECLARE v_nomposte VARCHAR(20); DECLARE v_dateach DATETIME; DECLARE v_dateins TIMESTAMP; DECLARE v_nlog VARCHAR(5); DECLARE v_nposte VARCHAR(7); --nb jours entier DECLARE v_attente SMALLINT; --nb jour décimal DECLARE v_jourdecimal DECIMAL(8,2); --écriture en format "TIME étendu" DECLARE v_chainejour VARCHAR(30); DECLARE curseur CURSOR FOR SELECT l.nomlog,p.nomposte,l.dateach,i.dateins,i.nlog,i.nposte FROM Installer i, Logiciel l, Poste p WHERE i.nposte = p.nposte AND i.nlog = l.nlog; DECLARE CONTINUE HANDLER FOR NOT FOUND SET fincurs := 1; OPEN curseur; FETCH curseur INTO v_nomlog,v_nomposte,v_dateach,v_dateins,v_nlog,v_nposte; WHILE (NOT fincurs) DO IF v_dateach IS NULL THEN (CONCAT('Date d''achat inconnue pour le logiciel ', v_nomlog,' sur ',v_nomposte)); ELSE SET v_attente := DATEDIFF(v_dateIns,v_dateAch); IF v_attente < 0 THEN
10 Corrigés des exos 19 (CONCAT('Logiciel ',v_nomlog,' installé sur ', v_nomposte,' ', -v_attente,' jour(s) avant l''achat!')); ELSE IF v_attente = 0 THEN (CONCAT(v_nomLog,' sur ',v_nomposte, ' acheté et installé le même jour!')) ; ELSE (CONCAT('Logiciel ',v_nomlog,' sur ',v_nomposte, ' attente ',v_attente,' jour(s).')); SET v_jourdecimal := TIMESTAMPDIFF(SECOND,v_dateAch,v_dateIns)/(24*3600); SET v_chainejour := CONCAT(SIGN(v_jourdecimal) * FLOOR(ABS(v_jourdecimal))," j ", SEC_TO_TIME((ABS(v_jourdecimal)-FLOOR(ABS(v_jourdecimal)))* 86400)); (CONCAT('En format TIME étendu ', v_chainejour)); UPDATE Installer SET delai = v_jourdecimal WHERE nposte = v_nposte AND nlog = v_nlog; FETCH curseur INTO v_nomlog,v_nomposte,v_dateach,v_dateins,v_nlog,v_nposte; END WHILE; CLOSE curseur; SELECT * FROM test.trace; --Test et appel UPDATE Installer SET delai = NULL SELECT * FROM Installer DELETE FROM test.trace CALL calcultemps() --Vérification SELECT * FROM Installer Transaction delimiter DROP TABLE IF EXISTS test.trace CREATE TABLE test.trace(message VARCHAR(80)) DROP PROCEDURE IF EXISTS installlogseg CREATE PROCEDURE installlogseg (IN param1 VARCHAR(11), IN param2 VARCHAR(5),IN param3 VARCHAR(20), IN param4 TIMESTAMP, IN param5 VARCHAR(7), IN param6 VARCHAR(9), IN param7 DECIMAL(6,2)) DECLARE fincurs BOOLEAN DEFAULT 0; DECLARE v_nomposte VARCHAR(20); DECLARE v_nomsalle VARCHAR(20); DECLARE v_nposte VARCHAR(7); DECLARE curseur CURSOR FOR SELECT p.nomposte,p.nposte,s.nomsalle FROM Poste p, Salle s WHERE p.indip = param1 AND p.typeposte = param6 AND p.nsalle = s.nsalle; DECLARE CONTINUE HANDLER FOR NOT FOUND SET fincurs := 1; SET AUTOCOMMIT = 0; INSERT INTO Logiciel VALUES (param2,param3,param4,param5,param6,param7,0); (CONCAT(param3,' stocké dans la table Logiciel')); OPEN curseur; FETCH curseur INTO v_nomposte,v_nposte,v_nomsalle; WHILE (NOT fincurs) DO INSERT INTO Installer (nposte,nlog,delai) VALUES(v_nPoste, param2, TIMESTAMPDIFF(SECOND,param4,SYSDATE())/(24*3600) ); (CONCAT('Installation sur ',v_nomposte,' dans ',v_nomsalle)); FETCH curseur INTO v_nomposte,v_nposte,v_nomsalle;
11 20 Corrigés des exos END WHILE; CLOSE curseur; COMMIT; SELECT * FROM test.trace; CALL installlogseg(' ', 'log99','blaster', ' ', '9.9', 'PCWS', ) SELECT * FROM Logiciel SELECT * FROM Installer WHERE nlog='log99' -- DELETE FROM Installer WHERE nlog='log99' DELETE FROM Logiciel WHERE nlog='log99' Exceptions delimiter DROP TABLE IF EXISTS test.trace CREATE TABLE test.trace(message VARCHAR(80)) DROP PROCEDURE IF EXISTS installlogseg CREATE PROCEDURE installlogseg (IN param1 VARCHAR(11), IN param2 VARCHAR(5),IN param3 VARCHAR(20), IN param4 TIMESTAMP, IN param5 VARCHAR(7), IN param6 VARCHAR(9), IN param7 DECIMAL(6,2)) DECLARE fincurs BOOLEAN DEFAULT 0; DECLARE doublontrouve BOOLEAN DEFAULT 0; DECLARE pereinexistant BOOLEAN DEFAULT 0; DECLARE nbrinstall TINYINT DEFAULT 0; DECLARE v_nomseg VARCHAR(20); DECLARE v_nomposte VARCHAR(20); DECLARE v_nomsalle VARCHAR(20); DECLARE v_nposte VARCHAR(7); DECLARE curseur CURSOR FOR SELECT p.nomposte,p.nposte,s.nomsalle FROM Poste p, Salle s WHERE p.indip = param1 AND p.typeposte = param6 AND p.nsalle = s.nsalle; DECLARE CONTINUE HANDLER FOR NOT FOUND SET fincurs := 1; DECLARE CONTINUE HANDLER FOR 1062 SET doublontrouve := 1; DECLARE CONTINUE HANDLER FOR 1452 SET pereinexistant := 1; -- numéro de segment inconnu? SELECT nomsegment INTO v_nomseg FROM Segment WHERE indip=param1; IF (fincurs) THEN (CONCAT('Mauvais code segment : ',param1)); ELSE -- numéro de logiciel déjà présent? SET AUTOCOMMIT = 0; INSERT INTO Logiciel VALUES (param2,param3,param4,param5,param6,param7,0); IF (doublontrouve) THEN (CONCAT('Logiciel : ',param2,' déjà présent!')); ELSE IF (pereinexistant) THEN (CONCAT('Type du logiciel : ',param6,' non référencé!')); ELSE IF (DATEDIFF(SYSDATE(),param4)<0) THEN (CONCAT('Date achat plus grande que celle du jour!')); ELSE (CONCAT(param3,' stocké dans la table Logiciel')); OPEN curseur; FETCH curseur INTO v_nomposte,v_nposte,v_nomsalle; WHILE (NOT fincurs) DO SET nbrinstall := nbrinstall +1; INSERT INTO Installer (nposte,nlog,delai) VALUES(v_nPoste, param2, TIMESTAMPDIFF(SECOND,param4,SYSDATE())/(24*3600) ); (CONCAT('Installation sur ',v_nomposte,' dans ',v_nomsalle)); FETCH curseur INTO v_nomposte,v_nposte,v_nomsalle;
12 Corrigés des exos 21 END WHILE; IF (nbrinstall=0) THEN (CONCAT('Aucune installation sur le segment',param1,' de ',param2)); CLOSE curseur; SELECT * FROM test.trace; --test segment DELETE FROM test.trace CALL installlogseg('toto', 'log99','blaster', ' ', '9.9', 'PCWS', 999.9) SELECT * FROM test.trace --test logiciel déjà présent --ERROR 1062 (23000): Duplicate entry 'log1' for key 1 DELETE FROM test.trace CALL installlogseg(' ', 'log1','blaster', ' ', '9.9', 'PCWS', 999.9) --test type du logiciel DELETE FROM test.trace CALL installlogseg(' ', 'log98','mozilla', ' ', '1', 'toto', 100.0) --date d achat plus grande que celle du jour? -- DATEDIFF(v_dateIns,v_dateAch); DELETE FROM test.trace CALL installlogseg(' ', 'log98','mozilla', ' ', '1', 'PCWS', 100.0) --aucune install DELETE FROM test.trace CALL installlogseg(' ', 'log55','eudora', ' ', '5', 'PCWS', 540) --bonne installation DELETE FROM test.trace CALL installlogseg(' ', 'log77','blog Up', ' ', '1.3', 'PCWS', 90) SELECT * FROM Logiciel SELECT * FROM Installer WHERE nlog='log77' Déclencheurs Mises à jour de colonnes CREATE TRIGGER Trig_AD_Installer AFTER DELETE ON Installer FOR EACH ROW UPDATE Poste SET nblog=nblog - 1 WHERE nposte = OLD.nPoste; UPDATE Logiciel SET nbinstall = nbinstall - 1 WHERE nlog = OLD.nLog; CREATE TRIGGER Trig_AI_Installer AFTER INSERT ON Installer FOR EACH ROW UPDATE Poste SET nblog = nblog + 1 WHERE nposte = NEW.nPoste; UPDATE Logiciel SET nbinstall = nbinstall + 1 WHERE nlog = NEW.nLog; CREATE TRIGGER Trig_AI_Poste AFTER INSERT ON Poste FOR EACH ROW UPDATE Salle SET nbposte=nbposte+1 WHERE nsalle = NEW.nSalle; CREATE TRIGGER Trig_AD_Poste AFTER DELETE ON Poste FOR EACH ROW UPDATE Salle SET nbposte = nbposte - 1 WHERE nsalle = OLD.nSalle; CREATE TRIGGER Trig_AU_Salle AFTER UPDATE ON Salle FOR EACH ROW
13 22 Corrigés des exos DECLARE differ TINYINT(2); SET differ := NEW.nbPoste - OLD.nbPoste; UPDATE Segment SET nbposte = nbposte + differ WHERE indip = NEW.indIP; Programmation de contraintes DROP TABLE IF EXISTS test.trace CREATE TABLE test.trace(col VARCHAR(80) PRIMARY KEY) CREATE TRIGGER Trig_BI_Installer BEFORE INSERT ON Installer FOR EACH ROW DECLARE v_type_log VARCHAR(9); DECLARE v_type_pos VARCHAR(9); DECLARE v_date_achat DATETIME; SELECT typelog, dateach INTO v_type_log,v_date_achat FROM Logiciel WHERE NEW.nLog = nlog; SELECT typeposte INTO v_type_pos FROM Poste WHERE NEW.nPoste = nposte; IF NOT (v_type_log = v_type_pos) THEN -- Les types ne correspondent pas : on fait planter... (NULL); IF NEW.dateIns IS NOT NULL THEN IF DATEDIFF(NEW.dateIns,v_date_achat) < 0 THEN -- Installation antérieure a la date achat (NULL); Chapitre 8 Curseur statique public static ArrayList getsalles() { ArrayList tableaurésultat = new ArrayList(); try { etat = cx.createstatement(); rs = etat.executequery("select * FROM Salle"); String [] ligne = null; while (rs.next()) { ligne = new String[4]; ligne[0] = rs.getstring(1); ligne[1] = rs.getstring(2); ligne[2] = (new Integer(rs.getInt(3))).toString(); ligne[3] = rs.getstring(4); tableaurésultat.add(ligne); rs.close(); etat.close(); catch (SQLException ex) { while (ex!= null) { System.out.println ("Statut SQL : "+ex.getsqlstate()); System.out.println ("Message : "+ex.getmessage()); System.out.println ("Code erreur : "+ex.geterrorcode()); ex = ex.getnextexception(); return tableaurésultat; --main()
14 Corrigés des exos 23 ArrayList lignes = getsalles(); System.out.println("Liste des salles :\n"); System.out.println("nSalle\tnomSalle \tnbposte\tindip"); System.out.println(" "); String[] lig; for (int i=0;i<lignes.size();i++) {lig=(string [])lignes.get(i); System.out.println(lig[0]+" \t"+lig[1]+" \t"+lig[2]+" \t"+lig[3]); Curseur modifiable public static void deletesalle(int nl) {try { etatmodifiable = cx.createstatement(resultset.type_scroll_insensitive, ResultSet.CONCUR_UPDATABLE); cx.setautocommit(false); rs2 = etatmodifiable.executequery("select s.* FROM Salle s"); if (rs2.absolute(nl)) { rs2.deleterow(); cx.commit(); System.out.println("Salle supprimée"); else System.out.println("Désolé, pas de "+ nl +" ème salle!"); rs2.close(); etatmodifiable.close(); catch (SQLException ex) { while (ex!= null) { System.out.println ("Statut SQL : "+ex.getsqlstate()); System.out.println ("Message : "+ex.getmessage()); System.out.println ("Code erreur : "+ex.geterrorcode()); ex = ex.getnextexception(); Appel d un sous programme Chapitre 9 public static int deletesallesp(string ns) { int result = 0; try {cetat = cx.preparecall("{call supprimesalle(?,?)"); cetat.registeroutparameter(2,java.sql.types.integer); cetat.setstring(1,ns); cetat.execute(); result = cetat.getint(2); cetat.close(); catch (SQLException ex) { while (ex!= null) { System.out.println ("Statut SQL : "+ex.getsqlstate()); System.out.println ("Message : "+ex.getmessage()); System.out.println ("Code erreur : "+ex.geterrorcode()); ex = ex.getnextexception(); return result; Extraction préparée (exo1suite.php) <html> <head> <title>installations d'une salle</title> </head> <body> <?php if ( (service = mysqli_connect('localhost','soutou','iut','bdsoutou')) > 0) { numsalle = _POST['ns']; requete = "SELECT l.nomlog,i.nposte,i.dateins,l.dateach FROM bdsoutou.installer i, bdsoutou.logiciel l, bdsoutou.poste p WHERE l.nlog=i.nlog AND p.nposte=i.nposte AND p.nsalle='numsalle' ORDER BY 1,2,3"; ordre = mysqli_prepare(service,requete); if ( (res = mysqli_stmt_execute(ordre)) > 0) {
15 24 Corrigés des exos if ( (resbind = mysqli_stmt_bind_result(ordre,v1,v2,v3,v4)) > 0) { print "<H4>Liste des Installation de la salle numsalle</h4>"; trouve=0; print "<TABLE BORDER=1> "; print "<tr><th>nom Logiciel</th><th>Poste</th><th>Installation </th><th>achat</th></tr>"; while (mysqli_stmt_fetch(ordre)) { trouve=1; print "<TR> <TD> v1</td>" ; print " <TD> v2</td>"; print " <TD> v3</td>"; print " <TD> v4</td> </TR> "; print "</TABLE> "; if (trouve==0) print "<BR>Aucune installation dans la salle"; else print "<BR>La liaison est un échec!"; else print "<BR>La requete est un échec!"; mysqli_stmt_close(ordre); mysqli_close(service); else print "<BR> La connexion est un échec!";?> </body> </html> Appel d un sous-programme (exo2suite.php) <html> <head> <title>suppression d'une salle</title> </head> <body> <?php if ( (service = mysqli_connect('localhost','soutou','iut','bdsoutou')) > 0) { mysqli_autocommit(service,false); numsalle = _POST['ns']; if (result = mysqli_multi_query(service, "call bdsoutou.supprimesalle('numsalle',@v_retour)") > 0) {print "<BR>Procédure réalisée correctement."; if (result2 = {ligne = mysqli_fetch_array(result2, MYSQLI_NUM); if (ligne[0] == -1) print "<BR>Désolé, la salle numsalle n'existe pas!"; if (ligne[0] == 0) print "<BR>La salle numsalle est supprimée"; if (ligne[0] == -2) print "<BR>Désolé, la salle numsalle est référencée par un poste de travail!"; mysqli_free_result(result2); else { print "<BR>Problème au retour du paramètre ".mysqli_error(service); else { print "<BR>La procédure est un échec! ".mysqli_error(service); mysqli_close(service); else print "<BR> La connexion est un échec!";?> </body> </html> Insertion préparée (exo3suite.php) <html> <head> <title>ajout d'une installation</title> </head> <body> <?php if ( (service = mysqli_connect('localhost','soutou','iut','bdsoutou')) > 0) {mysqli_autocommit(service,false); numposte = _POST['np'];
16 Corrigés des exos 25 numlogi = _POST['nl']; insert3 = "INSERT INTO bdsoutou.installer (nposte,nlog,dateins,delai) VALUES (?,?,SYSDATE(),NULL)"; ordre = mysqli_prepare(service, insert3); if ( (mysqli_stmt_bind_param(ordre,'ss',numposte,numlogi)) > 0) {if ( (res = mysqli_stmt_execute(ordre)) > 0) {print "<BR>Enregistrement (numlogi, numposte) inséré, (en sequence : ".mysqli_insert_id(service).")"; mysqli_commit(service); mysqli_stmt_free_result(ordre); else {print "<BR>L'insertion de numlogi sur numposte est un échec!"; print "<BR><B>Message : </B>".mysqli_stmt_error(ordre); print "<BR><B>Code : </B>".mysqli_stmt_errno(ordre); else print "<BR>Problème au bind!"; mysqli_close(service); else print "<BR> La connexion est un échec!";?> </body> </html>
Corrigés des exercices SQL pour Oracle
Chapitre 1 Corrigés des exercices SQL pour Oracle Création des tables (creparc.sql) CREATE TABLE Segment (indip VARCHAR2(11), nomsegment VARCHAR2(20) CONSTRAINT nn_nomsegment NOT NULL, etage NUMBER(2),
Brazil + JDBC Juin 2001, [email protected] http://jfod.cnam.fr/tp_cdi/douin/
Brazil + JDBC Juin 2001, [email protected] http://jfod.cnam.fr/tp_cdi/douin/ version du 26 Mai 2003 : JDBC-SQL et Brazil pré-requis : lecture de Tutorial JDBC de Sun Bibliographie Brazil [Bra00]www.sun.com/research/brazil
Thursday, February 7, 2013. DOM via PHP
DOM via PHP Plan PHP DOM PHP : Hypertext Preprocessor Langage de script pour création de pages Web dynamiques Un ficher PHP est un ficher HTML avec du code PHP
Licence Informatique Année 2005-2006. Exceptions
Université Paris 7 Java Licence Informatique Année 2005-2006 TD n 8 - Correction Exceptions Exercice 1 La méthode parseint est spécifiée ainsi : public static int parseint(string s) throws NumberFormatException
Langages Orientés Objet Java
Langages Orientés Objet Java Exceptions Arnaud LANOIX Université Nancy 2 24 octobre 2006 Arnaud LANOIX (Université Nancy 2) Langages Orientés Objet Java 24 octobre 2006 1 / 32 Exemple public class Example
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";! SET time_zone = "+00:00";!
-- phpmyadmin SQL Dump -- version 4.1.3 -- http://www.phpmyadmin.net -- -- Client : localhost -- Généré le : Lun 19 Mai 2014 à 15:06 -- Version du serveur : 5.6.15 -- Version de PHP : 5.4.24 SET SQL_MODE
Introduction au BIM. ESEB 38170 Seyssinet-Pariset Economie de la construction email : [email protected]
Quel est l objectif? 1 La France n est pas le seul pays impliqué 2 Une démarche obligatoire 3 Une organisation plus efficace 4 Le contexte 5 Risque d erreur INTERVENANTS : - Architecte - Économiste - Contrôleur
TP : Système de messagerie - Fichiers properties - PrepareStatement
TP : Système de messagerie - Fichiers properties - PrepareStatement exelib.net Une société souhaite mettre en place un système de messagerie entre ses employés. Les travaux de l équipe chargée de l analyse
Using SQL Server Management Studio
Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases
LSINF1124 Projet de programmation
LSINF1124 Projet de programmation Database Programming with Java TM Sébastien Combéfis University of Louvain (UCLouvain) Louvain School of Engineering (EPL) March 1, 2011 Introduction A database is a collection
--- Vincent Hamel, hamv2701 14 162 988
--- Vincent Hamel, hamv2701 14 162 988 ------------------------------------------------- drop table Aeroport cascade constraints; create table Aeroport ( codeaeroport varchar(20), ville varchar(20), etat
TP1 : Correction. Rappels : Stream, Thread et Socket TCP
Université Paris 7 M1 II Protocoles réseaux TP1 : Correction Rappels : Stream, Thread et Socket TCP Tous les programmes seront écrits en Java. 1. (a) Ecrire une application qui lit des chaines au clavier
Chapter 9 Java and SQL. Wang Yang [email protected]
Chapter 9 Java and SQL Wang Yang [email protected] Outline Concern Data - File & IO vs. Database &SQL Database & SQL How Connect Java to SQL - Java Model for Database Java Database Connectivity (JDBC)
Pro3 1 : listes chaînées
Initiation à l algorithmique, L2 2005-2006, JC Fournier 3.1 Pro3 1 : listes chaînées Spécification : 1 generic 2 type element i s private ; 3 package l i s t e s c h a i n is 4 5 type position is private
Memo bconsole. Memo bconsole
Memo bconsole Page 1 / 24 Version du 10 Avril 2015 Page 2 / 24 Version du 10 Avril 2015 Sommaire 1 Voir les différentes travaux effectués par bacula3 11 Commande list jobs 3 12 Commande sqlquery 3 2 Afficher
Personnalisez votre intérieur avec les revêtements imprimés ALYOS design
Plafond tendu à froid ALYOS technology ALYOS technology vous propose un ensemble de solutions techniques pour vos intérieurs. Spécialiste dans le domaine du plafond tendu, nous avons conçu et développé
How To Create A Table In Sql 2.5.2.2 (Ahem)
Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or
POB-JAVA Documentation
POB-JAVA Documentation 1 INTRODUCTION... 4 2 INSTALLING POB-JAVA... 5 Installation of the GNUARM compiler... 5 Installing the Java Development Kit... 7 Installing of POB-Java... 8 3 CONFIGURATION... 9
Remote Method Invocation
1 / 22 Remote Method Invocation Jean-Michel Richer [email protected] http://www.info.univ-angers.fr/pub/richer M2 Informatique 2010-2011 2 / 22 Plan Plan 1 Introduction 2 RMI en détails
System Requirements Orion
Orion Date 21/12/12 Version 1.0 Référence 001 Auteur Antoine Crué VOS CONTACTS TECHNIQUES JEAN-PHILIPPE SENCKEISEN ANTOINE CRUE LIGNE DIRECTE : 01 34 93 35 33 EMAIL : [email protected] LIGNE DIRECTE
Solaris 10 Documentation README
Solaris 10 Documentation README Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 817 0550 10 January 2005 Copyright 2005 Sun Microsystems, Inc. 4150 Network Circle, Santa
CSS : petits compléments
CSS : petits compléments Université Lille 1 Technologies du Web CSS : les sélecteurs 1 au programme... 1 ::before et ::after 2 compteurs 3 media queries 4 transformations et transitions Université Lille
Sun Management Center Change Manager 1.0.1 Release Notes
Sun Management Center Change Manager 1.0.1 Release Notes Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 817 0891 10 May 2003 Copyright 2003 Sun Microsystems, Inc. 4150
--Nom: Laurent Senécal-Léonard 14 143 483
--Nom: Laurent Senécal-Léonard 14 143 483 --Création de la table aéroport et de ses attributs drop table Aeroport cascade constraints; create table Aeroport ( codeaeroport varchar2(6) not null, ville varchar2(20)
Archived Content. Contenu archivé
ARCHIVED - Archiving Content ARCHIVÉE - Contenu archivé Archived Content Contenu archivé Information identified as archived is provided for reference, research or recordkeeping purposes. It is not subject
Programming Database lectures for mathema
Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$
niveau : 1 ere année spécialité : mécatronique & froid et climatisation AU : 2014-2015 Programmation C Travaux pratiques
École Supérieure Privée d Ingénieurs de Monastir niveau : 1 ere année spécialité : mécatronique & froid et climatisation AU : 2014-2015 Programmation C Travaux pratiques Correction Exercice 1 TP3 long
Is Paradox a good front-end for MySql?
Is Paradox a good front-end for MySql? Caution Be aware that some functionalities of Paradox concerning non standard alias (ODBC and SQL) are broken with the Service Pack 2 of windows XP. You can check
The Need For Speed. leads to PostgreSQL. Dimitri Fontaine [email protected]. 28 Mars 2013
The Need For Speed leads to PostgreSQL Dimitri Fontaine [email protected] 28 Mars 2013 Dimitri Fontaine [email protected] The Need For Speed 28 Mars 2013 1 / 23 Dimitri Fontaine 2ndQuadrant France
A table is a collection of related data entries and it consists of columns and rows.
CST 250 MySQL Notes (Source: www.w3schools.com) MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables.
Introduction. GEAL Bibliothèque Java pour écrire des algorithmes évolutionnaires. Objectifs. Simplicité Evolution et coévolution Parallélisme
GEAL 1.2 Generic Evolutionary Algorithm Library http://dpt-info.u-strasbg.fr/~blansche/fr/geal.html 1 /38 Introduction GEAL Bibliothèque Java pour écrire des algorithmes évolutionnaires Objectifs Généricité
A basic create statement for a simple student table would look like the following.
Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));
N1 Grid Service Provisioning System 5.0 User s Guide for the Linux Plug-In
N1 Grid Service Provisioning System 5.0 User s Guide for the Linux Plug-In Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 819 0735 December 2004 Copyright 2004 Sun Microsystems,
Sun StorEdge A5000 Installation Guide
Sun StorEdge A5000 Installation Guide for Windows NT Server 4.0 Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 USA 650 960-1300 Fax 650 969-9131 Part No. 805-7273-11 October 1998,
Upgrading the Solaris PC NetLink Software
Upgrading the Solaris PC NetLink Software By Don DeVitt - Enterprise Engineering Sun BluePrints OnLine - January 2000 http://www.sun.com/blueprints Sun Microsystems, Inc. 901 San Antonio Road Palo Alto,
Liste d'adresses URL
Liste de sites Internet concernés dans l' étude Le 25/02/2014 Information à propos de contrefacon.fr Le site Internet https://www.contrefacon.fr/ permet de vérifier dans une base de donnée de plus d' 1
PROCEDURE INSERTION(NUM IN EMPLOYES.NUMEMP%TYPE, NOM VARCHAR2, PRENOM IN VARCHAR2, PPHOTO IN BLOB, SALAIRE IN NUMBER);
Le Package CREATE OR REPLACE PACKAGE GESTIONEMPLOYES AS DECLARATION DE LA VARIABLE DE TYPE REF CURSOR DECLARATION DES PROCÉDURES ET FONCTIONS TYPE EMPRESULTAT IS REF CURSOR; PROCEDURE INSERTION(NUM IN
Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)
13 November 2007 22:30 Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA) By: http://www.alberton.info/firebird_sql_meta_info.html The SQL 2003 Standard introduced a new schema
Audit de sécurité avec Backtrack 5
Audit de sécurité avec Backtrack 5 DUMITRESCU Andrei EL RAOUSTI Habib Université de Versailles Saint-Quentin-En-Yvelines 24-05-2012 UVSQ - Audit de sécurité avec Backtrack 5 DUMITRESCU Andrei EL RAOUSTI
Calcul parallèle avec R
Calcul parallèle avec R ANF R Vincent Miele CNRS 07/10/2015 Pour chaque exercice, il est nécessaire d ouvrir une fenètre de visualisation des processes (Terminal + top sous Linux et Mac OS X, Gestionnaire
SunFDDI 6.0 on the Sun Enterprise 10000 Server
SunFDDI 6.0 on the Sun Enterprise 10000 Server Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 USA 650 960-1300 Fax 650 969-9131 Part No.: 806-3610-11 November 1999, Revision A Send
Note concernant votre accord de souscription au service «Trusted Certificate Service» (TCS)
Note concernant votre accord de souscription au service «Trusted Certificate Service» (TCS) Veuillez vérifier les éléments suivants avant de nous soumettre votre accord : 1. Vous avez bien lu et paraphé
Installation troubleshooting guide
Installation troubleshooting guide Content ERROR CODE PROBLEMS... 3 Error code 301: Unknown protection system. Verify the installation.... 3 Error code 302: The software cannot be used. The computer date
We are pleased to present you with detailed instructions on processing your visa application with us. Within this information pack you will find:
Dear Client, We are pleased to present you with detailed instructions on processing your visa application with us. Within this information pack you will find: A list of the required documents for your
Introduction ToIP/Asterisk Quelques applications Trixbox/FOP Autres distributions Conclusion. Asterisk et la ToIP. Projet tuteuré
Asterisk et la ToIP Projet tuteuré Luis Alonso Domínguez López, Romain Gegout, Quentin Hourlier, Benoit Henryon IUT Charlemagne, Licence ASRALL 2008-2009 31 mars 2009 Asterisk et la ToIP 31 mars 2009 1
TP JSP : déployer chaque TP sous forme d'archive war
TP JSP : déployer chaque TP sous forme d'archive war TP1: fichier essai.jsp Bonjour Le Monde JSP Exemple Bonjour Le Monde. Après déploiement regarder dans le répertoire work de l'application
SQL. Short introduction
SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.
Configuration Guide. SafeNet Authentication Service. SAS Agent for AD FS
SafeNet Authentication Service Configuration Guide SAS Agent for AD FS Technical Manual Template Release 1.0, PN: 000-000000-000, Rev. A, March 2013, Copyright 2013 SafeNet, Inc. All rights reserved. 1
Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.
& & 1 & 2 Lecture #7 2008 3 Terminology Structure & & Database server software referred to as Database Management Systems (DBMS) Database schemas describe database structure Data ordered in tables, rows
Modifier le texte d'un élément d'un feuillet, en le spécifiant par son numéro d'index:
Bezier Curve Une courbe de "Bézier" (fondé sur "drawing object"). select polygon 1 of page 1 of layout "Feuillet 1" of document 1 set class of selection to Bezier curve select Bezier curve 1 of page 1
TP N 10 : Gestion des fichiers Langage JAVA
TP N 10 : Gestion des fichiers Langage JAVA Rappel : Exemple d utilisation de FileReader/FileWriter import java.io.*; public class Copy public static void main(string[] args) throws IOException File inputfile
2 RENSEIGNEMENTS CONCERNANT L ASSURÉ SI CELUI-CI N EST PAS LE REQUÉRANT INFORMATION CONCERNING THE INSURED PERSON IF OTHER THAN THE APPLICANT
SÉCURITÉ SOCIALE SOCIAL SECURITY ACCORD DU 9 FÉVRIER 1979 ENTRE LA FRANCE ET LE CANADA AGREEMENT OF FEBRUARY 9, 1979 BETWEEN FRANCE AND CANADA Formulaire FORM SE 401-06 INSTRUCTION D UNE DEMANDE DE PENSION
The Register of the Domain of the State A Revolution in the Registration of Land Rights
The Register of the Domain of the State A Revolution in the Registration of Land Rights Daniel ROBERGE, Canada Key words: government, rights in public land, Internet, Register, Registration system, Cadastre
Course Objectives. Database Applications. External applications. Course Objectives Interfacing. Mixing two worlds. Two approaches
Course Objectives Database Applications Design Construction SQL/PSM Embedded SQL JDBC Applications Usage Course Objectives Interfacing When the course is through, you should Know how to connect to and
Machine de Soufflage defibre
Machine de Soufflage CABLE-JET Tube: 25 à 63 mm Câble Fibre Optique: 6 à 32 mm Description générale: La machine de soufflage parfois connu sous le nom de «câble jet», comprend une chambre d air pressurisé
Etudes de cas en OCL avec l outil USE 2
Etudes de cas en OCL avec l outil USE 2 1 2 UML-based Specification Environment 3 1ère étude de cas : invariants Classes en notation textuelle model Company 4 class Employee attributes name : String salary
Memory Eye SSTIC 2011. Yoann Guillot. Sogeti / ESEC R&D yoann.guillot(at)sogeti.com
Memory Eye SSTIC 2011 Yoann Guillot Sogeti / ESEC R&D yoann.guillot(at)sogeti.com Y. Guillot Memory Eye 2/33 Plan 1 2 3 4 Y. Guillot Memory Eye 3/33 Memory Eye Analyse globale d un programme Un outil pour
at à 02 :00 PM on le 2016-01-25
RETURN BIDS TO : Shared Services Canada / Services partagés Canada C/O Andrew Nimmo (Contracting Authority) [email protected] 180 Kent St.,13th Floor, Ottawa, ON, K1G 4A8 REQUEST FOR PROPOSAL DEMANDE
Sun Management Center 3.5 Update 1b Release Notes
Sun Management Center 3.5 Update 1b Release Notes Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 819 3054 10 June 2005 Copyright 2005 Sun Microsystems, Inc. 4150 Network
ACP-EU Cooperation Programme in Science and Technology (S&T II) / Programme de Coopération ACP-UE pour la Science et la Technologie
ACP Science and Technologie Programme Programme Management Unit ACP-EU Cooperation Programme in Science and Technology (S&T II) / Programme de Coopération ACP-UE pour la Science et la Technologie EuropeAid/133437/D/ACT/ACPTPS
A Brief Introduction to MySQL
A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term
SQL Server An Overview
SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system
Annexe - OAuth 2.0. 1 Introduction. Xavier de Rochefort [email protected] - labri.fr/~xderoche 15 mai 2014
1 Introduction Annexe - OAuth 2.0. Xavier de Rochefort [email protected] - labri.fr/~xderoche 15 mai 2014 Alternativement à Flickr, notre serveur pourrait proposer aux utilisateurs l utilisation de leur
Administrer les solutions Citrix XenApp et XenDesktop 7.6 CXD-203
Administrer les solutions Citrix XenApp XenDesktop 7.6 CXD-203 MIEL Centre Agréé : N 11 91 03 54 591 Pour contacter le service formation : 01 60 19 16 27 Pour consulter le planning des formations : www.miel.fr/formation
Microsoft SQL connection to Sysmac NJ Quick Start Guide
Microsoft SQL connection to Sysmac NJ Quick Start Guide This Quick Start will show you how to connect to a Microsoft SQL database it will not show you how to set up the database. Watch the corresponding
Archived Content. Contenu archivé
ARCHIVED - Archiving Content ARCHIVÉE - Contenu archivé Archived Content Contenu archivé Information identified as archived is provided for reference, research or recordkeeping purposes. It is not subject
database abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia [email protected]
Lukas Smith database abstraction layers in PHP BackendMedia 1 Overview Introduction Motivation PDO extension PEAR::MDB2 Client API SQL syntax SQL concepts Result sets Error handling High level features
Sun Enterprise Optional Power Sequencer Installation Guide
Sun Enterprise Optional Power Sequencer Installation Guide For the Sun Enterprise 6500/5500 System Cabinet and the Sun Enterprise 68-inch Expansion Cabinet Sun Microsystems, Inc. 901 San Antonio Road Palo
Database Administration with MySQL
Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational
Oracle Database 10g Express
Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives
ENABLING OBJECTIVE AND TEACHING POINTS. DRILL: 401.02 5. TIME: One 30 minutes period. 6. METHOD/APPROACH: a. demonstration; and. b. performance.
CHAPTER 4: LESSON SPECIFICATIONS COURSE TITLE: GREEN STAR COURSE ENABLING OBJECTIVE AND TEACHING POINTS CTS NUMBER: A-CR-CCP-116/PC-001 TRAINING DETAILS DRILL: 401.02 5. TIME: One 30 minutes period. 1.
Les Broadcast Receivers...
Les Broadcast Receivers... http://developer.android.com/reference/android/content/broadcastreceiver.html Mécanisme qui, une fois «enregistré» dans le système, peut recevoir des Intents Christophe Logé
GSAC CONSIGNE DE NAVIGABILITE définie par la DIRECTION GENERALE DE L AVIATION CIVILE Les examens ou modifications décrits ci-dessous sont impératifs. La non application des exigences contenues dans cette
Advance DBMS. Structured Query Language (SQL)
Structured Query Language (SQL) Introduction Commercial database systems use more user friendly language to specify the queries. SQL is the most influential commercially marketed product language. Other
CSC 443 Data Base Management Systems. Basic SQL
CSC 443 Data Base Management Systems Lecture 6 SQL As A Data Definition Language Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured
Aucune validation n a été faite sur l exemple.
Cet exemple illustre l utilisation du Type BLOB dans la BD. Aucune validation n a été faite sur l exemple. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
Proxy IMAP/POP/SMTP securisé avec Perdition, Postfix et SASL
Proxy IMAP/POP/SMTP securisé avec Perdition, Postfix et SASL Installation de perdition : apt-get install perdition openssl Généré 1 clé privé et 1 certificat auto-signé : cd /etc/perdition openssl genrsa
TP : Configuration de routeurs CISCO
TP : Configuration de routeurs CISCO Sovanna Tan Novembre 2010 révision décembre 2012 1/19 Sovanna Tan TP : Routeurs CISCO Plan 1 Présentation du routeur Cisco 1841 2 Le système d exploitation /19 Sovanna
site et appel d'offres
Définition des besoins et élaboration de l'avant-projet Publication par le client de l'offre (opération sur le externe) Start: 16/07/02 Finish: 16/07/02 ID: 1 Dur: 0 days site et appel d'offres Milestone
CSC 443 Database Management Systems. The SQL Programming Language
CSC 443 Database Management Systems Lecture 11 SQL Procedures and Triggers The SQL Programming Language By embedding SQL in programs written in other high-level programming languages, we produce impedance
Veritas Storage Foundation 5.0 Software for SPARC
Veritas Storage Foundation 5.0 Software for SPARC Release Note Supplement Sun Microsystems, Inc. www.sun.com Part No. 819-7074-10 July 2006 Submit comments about this document at: http://www.sun.com/hwdocs/feedback
14 Triggers / Embedded SQL
14 Triggers / Embedded SQL COMS20700 Databases Dr. Essam Ghadafi TRIGGERS A trigger is a procedure that is executed automatically whenever a specific event occurs. You can use triggers to enforce constraints
In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina
This Lecture Database Systems Lecture 5 Natasha Alechina The language, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly and Begg chapter
Tool & Asset Manager 2.0. User's guide 2015
Tool & Asset Manager 2.0 User's guide 2015 Table of contents Getting Started...4 Installation...5 "Standalone" Edition...6 "Network" Edition...7 Modify the language...8 Barcode scanning...9 Barcode label
Archived Content. Contenu archivé
ARCHIVED - Archiving Content ARCHIVÉE - Contenu archivé Archived Content Contenu archivé Information identified as archived is provided for reference, research or recordkeeping purposes. It is not subject
Sun StorEdge RAID Manager 6.2.21 Release Notes
Sun StorEdge RAID Manager 6.2.21 Release Notes formicrosoftwindowsnt Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 USA 650 960-1300 Fax 650 969-9131 Part No. 805-6890-11 November
Short Form Description / Sommaire: Carrying on a prescribed activity without or contrary to a licence
NOTICE OF VIOLATION (Corporation) AVIS DE VIOLATION (Société) Date of Notice / Date de l avis: August 29, 214 AMP Number / Numéro de SAP: 214-AMP-6 Violation committed by / Violation commise par : Canadian
Méthodes ensemblistes pour une localisation robuste de robots sous-marins
Méthodes ensemblistes pour une localisation robuste de robots sous-marins Jan Sliwka To cite this version: Jan Sliwka. Méthodes ensemblistes pour une localisation robuste de robots sous-marins. Automatique
Windows et Office XP, pack en 2 volumes : Microsoft Office 2003 KillerTips; Décrasser Windows X
Windows et Office XP, pack en 2 volumes : Microsoft Office 2003 KillerTips; Décrasser Windows XP Download: Windows et Office XP, pack en 2 volumes : Microsoft Office 2003 KillerTips; Décrasser Windows
Open call for tenders n SCIC C4 2014/01
EUROPEAN COMMISSION DIRECTORATE GENERAL FOR INTERPRETATION RESOURCES AND SUPPORT DIRECTORATE Open call for tenders n SCIC C4 2014/01 Accident and sickness insurance for Conference Interpreting Agents Questions
SQL Server Database Coding Standards and Guidelines
SQL Server Database Coding Standards and Guidelines http://www.sqlauthority.com Naming Tables: Stored Procs: Triggers: Indexes: Primary Keys: Foreign Keys: Defaults: Columns: General Rules: Rules: Pascal
Sun Cluster 2.2 7/00 Data Services Update: Apache Web Server
Sun Cluster 2.2 7/00 Data Services Update: Apache Web Server Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 U.S.A. 650-960-1300 Part No. 806-6121 July 2000, Revision A Copyright 2000
Reconstruction d un modèle géométrique à partir d un maillage 3D issu d un scanner surfacique
Reconstruction d un modèle géométrique à partir d un maillage 3D issu d un scanner surfacique Silvère Gauthier R. Bénière, W. Puech, G. Pouessel, G. Subsol LIRMM, CNRS, Université Montpellier, France C4W,
Creating Database Tables in Microsoft SQL Server
Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are
LAB 1: Getting started with WebMatrix. Introduction. Creating a new database. M1G505190: Introduction to Database Development
LAB 1: Getting started with WebMatrix Introduction In this module you will learn the principles of database development, with the help of Microsoft WebMatrix. WebMatrix is a software application which
