1- Quels sont les clients ?
2- Quels sont les noms des clients
3- Quels sont les noms des clients parisiens ?
4- Quels sont les noms des clients dont le nom commence par un "D" OU qui habitent PARIS ?
5- Quels sont les noms des clients dont le nom commence par un "D" ET qui habitent PARIS ?
6- Listez les numros de facture pour chaque client.
7- Donnez le nom des clients et les libells des articles qu'ils ont commands.
8- Quels sont les prix TTC des articles ?
9- Donnez le chiffre d'affaire (CA) HT et TTC depuis le 1/2/98.
10- Donnez les quantits commandes par client et par libell d'article.
11- Donnez le montant TTC de chaque facture.
12- Donnez la somme des paiements pour chaque facture.
13- Donnez le reste  payer pour chaque facture.
14- Quels sont les couples de clients qui habitent la mme ville ?



RQ1:
SELECT Client.* FROM Client;
RQ2:
SELECT Client.Nom FROM Client;
     
RQ3:
SELECT Client.Nom, Client.Ville FROM Client WHERE (((Client.Ville)="PARIS"));

RQ4:
SELECT Client.Nom, Client.Ville FROM Client WHERE (((Client.Nom) Like "D*")) OR (((Client.Ville)="PARIS"));
     
RQ5:
SELECT Client.Nom, Client.Ville FROM Client WHERE (((Client.Nom) Like "D*") AND ((Client.Ville)="PARIS"));

RQ6:
SELECT Facture.NoFact, Client.Nom FROM Client INNER JOIN Facture ON Client.NoClient = Facture.NoClient;

SELECT Facture.NoFact, Client.Nom
FROM Client, Facture 
WHERE Client.NoClient = Facture.NoClient;
    

RQ7:
SELECT Client.Nom, Article.Libell
FROM (Client INNER JOIN Facture ON Client.NoClient = Facture.NoClient) INNER JOIN (Article INNER JOIN Commande ON Article.RefArt = Commande.RefArt) ON Facture.NoFact = Commande.NoFact
ORDER BY Client.Nom;

SELECT Client.Nom, Article.Libell
FROM Client,Facture,Article,Commande
WHERE Client.NoClient = Facture.NoClient
  AND Facture.NoFact = Commande.NoFact
  AND Article.RefArt = Commande.RefArt
ORDER BY Client.Nom;
 
RQ8:
SELECT Article.Libell, [Article]![PU]*(1+[Article]![TVA]/100) AS PUTTC
FROM Article;
 
RQ9:
SELECT Sum(Commande.Qt*Article.PU) AS CAHT
FROM Facture, Article, Commande
WHERE Article.RefArt = Commande.RefArt AND Facture.NoFact = Commande.NoFact
AND ((Facture.Date>1/2/98));

RQ10:
SELECT Client.Nom, Article.Libell, Sum(Commande.Qt) AS SommeDeQt
FROM (Client INNER JOIN Facture ON Client.NoClient = Facture.NoClient) INNER JOIN (Article INNER JOIN Commande ON Article.RefArt = Commande.RefArt) ON Facture.NoFact = Commande.NoFact
GROUP BY Client.Nom, Article.Libell;

SELECT Client.Nom, Article.Libell, Sum(Commande.Qt) AS SommeDeQt
FROM  Client, Facture, Article,Commande
WHERE Client.NoClient = Facture.NoClient
  AND Facture.NoFact = Commande.NoFact
  AND Article.RefArt = Commande.RefArt
GROUP BY Client.Nom, Article.Libell;
 
RQ11:
SELECT Commande.NoFact, Sum([Article]![PU]*(1+[Article]![TVA]/100)*[Commande]![Qt]) AS MontantTotal
FROM Article INNER JOIN Commande ON Article.RefArt = Commande.RefArt
GROUP BY Commande.NoFact;

SELECT Commande.NoFact, Sum([Article]![PU]*(1+[Article]![TVA]/100)*[Commande]![Qt]) AS MontantTotal
FROM Article,Commande
WHERE Article.RefArt = Commande.RefArt
GROUP BY Commande.NoFact;
 

RQ12 :
SELECT Paiement.NoFact, Sum(Paiement.Paiement) AS SommeDePaiement
FROM Paiement
GROUP BY Paiement.NoFact;
 
RQ13:
SELECT Paiement.NoFact, Sum(Paiement.Paiement) AS SommeDePaiement
FROM Paiement
GROUP BY Paiement.NoFact;

RQ13:
SELECT RQ11.NoFact, [RQ11]![MontantTotal]-[RQ12]![SommeDePaiement] AS Reste_a_Payer
FROM RQ11 INNER JOIN RQ12 ON RQ11.NoFact = RQ12.NoFact;

SELECT RQ11.NoFact, [RQ11]![MontantTotal]-[RQ12]![SommeDePaiement] AS Reste_a_Payer
FROM RQ11, RQ12
WHERE RQ11.NoFact = RQ12.NoFact;
 
RQ14:
SELECT Client.Nom, Client_1.Nom, Client.Ville
FROM Client AS Client_1 INNER JOIN Client ON Client_1.Ville = Client.Ville
WHERE (((Client.Nom)>[Client_1].[Nom]))
ORDER BY Client.Nom, Client_1.Nom;

SELECT Client.Nom, Client_1.Nom, Client.Ville
FROM Client AS Client_1,Client
WHERE (((Client.Nom)>[Client_1].[Nom])) AND Client_1.Ville = Client.Ville
ORDER BY Client.Nom, Client_1.Nom;
 


