-- les binaires utilisant une version 'V43' pour le logiciel 'L16'
SELECT Binaire
FROM   Codes
WHERE  Version = 'V43'
  AND  Logiciel = 'L16';
-- Algebre relationnelle
SELECT DISTINCT C1.Binaire
FROM            Codes AS C1, Codes AS C2
WHERE           C1.Binaire = C2.Binaire
  AND           C1.Version = C2.Version
  AND           C1.Logiciel <> C2.Logiciel;
-- Calcul relationnel
SELECT DISTINCT Binaire
FROM            Codes AS C1
WHERE EXISTS    (SELECT * 
                 FROM   Codes AS C2
                 WHERE  C1.Binaire = C2.Binaire
                 AND    C1.Version = C2.Version
                 AND    C1.Logiciel <> C2.Logiciel);
-- Calcul relationnel
SELECT DISTINCT Binaire
FROM            Codes AS C1
WHERE NOT (Logiciel = ALL (SELECT Logiciel
                            FROM   Codes AS C2
                            WHERE  C1.Binaire = C2.Binaire
                              AND  C1.Version = C2.Version));
-- Utilisation des agregas
SELECT DISTINCT Binaire, COUNT(Logiciel)
FROM (SELECT DISTINCT Binaire, Version, Logiciel FROM Codes) AS R
GROUP BY        Binaire, Version
HAVING          COUNT(Logiciel) > 1;
-- Algebre relationnelle
SELECT DISTINCT C1.Fichier
FROM            Codes AS C1, Codes AS C2
WHERE           C1.Fichier = C2.Fichier
  AND           C1.Processeur = C2.Processeur
  AND           C1.Version <> C2.Version;

-- Calcul relationnel
SELECT DISTINCT Fichier
FROM            Codes AS C1
WHERE EXISTS    (SELECT *
                 FROM   Codes AS C2
                 WHERE  C1.Fichier = C2.Fichier
                 AND    C1.Processeur = C2.Processeur
                 AND    C1.Version <> C2.Version);
-- Calcul relationnel
SELECT DISTINCT Fichier
FROM            Codes AS C1
WHERE NOT (Version = ALL (SELECT Version
                        FROM   Codes AS C2
                        WHERE  C1.Fichier = C2.Fichier
                        AND    C1.Processeur = C2.Processeur));
-- Utilisation des agregas
SELECT DISTINCT Fichier, COUNT(Version)
FROM (SELECT DISTINCT Fichier, Processeur, Version FROM Codes) AS R
GROUP BY        Fichier, Processeur
HAVING          COUNT(Version) > 1;
-- Utilisation des agregas
SELECT DISTINCT Logiciel, COUNT(Binaire)
FROM (SELECT DISTINCT Logiciel, Binaire FROM Codes) AS R
GROUP BY        Logiciel
HAVING          COUNT(Binaire) < 6;
-- Utilisation des agregas
SELECT DISTINCT Fichier
FROM            (SELECT DISTINCT Logiciel, COUNT(Binaire)
                 FROM (SELECT DISTINCT Logiciel, Binaire FROM Codes) AS R
                 GROUP BY        Logiciel
                 HAVING          COUNT(Binaire) < 2) AS TMP1
    NATURAL JOIN Codes
  EXCEPT
SELECT DISTINCT Fichier
FROM            (SELECT DISTINCT Logiciel, COUNT(Binaire)
                 FROM (SELECT DISTINCT Logiciel, Binaire FROM Codes) AS R
                 GROUP BY        Logiciel
                 HAVING          COUNT(Binaire) > 9) AS TMP2
    NATURAL JOIN Codes;
-- Algebre relationnelle
SELECT DISTINCT Version, Logiciel, Processeur
FROM   Codes
  EXCEPT
SELECT C1.Version, C1.Logiciel, C1.Processeur
FROM   Codes AS C1, Codes AS C2
WHERE  C1.Version <> C2.Version
AND    C1.Logiciel = C2.Logiciel
AND    C1.Processeur = C2.Processeur;
-- Calcul relationnel
SELECT DISTINCT Version, Logiciel, Processeur
FROM   Codes AS C1
WHERE  NOT EXISTS
       (SELECT *
        FROM   Codes AS C2
        WHERE  C1.Version <> C2.Version
        AND    C1.Logiciel = C2.Logiciel
        AND    C1.Processeur = C2.Processeur);
-- Algebre relationnelle
SELECT DISTINCT Fichier
FROM   Codes
  EXCEPT
SELECT  Fichier
FROM (
  SELECT *
  FROM   (SELECT DISTINCT Fichier FROM Codes) AS PiR1, 
         (SELECT DISTINCT Binaire FROM Codes) AS R2
    EXCEPT
  SELECT Fichier, Binaire
  FROM   Codes
) AS NonEntierR1;
-- Calcul relationnel
SELECT DISTINCT Fichier
FROM   Codes AS P1
WHERE  NOT EXISTS
       (SELECT DISTINCT Binaire
         FROM  Codes AS P2
         WHERE  NOT EXISTS
                (SELECT DISTINCT Binaire
                 FROM   Codes AS P11
                 WHERE  P11.Fichier  = P1.Fichier
                 AND    P11.Binaire  = P2.Binaire));
