0% found this document useful (0 votes)
9 views

TP 4

The document contains 36 SQL queries that select data from various tables like articles, clients, commandes, fournisseur. The queries filter on fields, perform calculations like averages, counts, sums, use functions like concat, like, between, order by, group by, having, subqueries and joins.

Uploaded by

W Po
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

TP 4

The document contains 36 SQL queries that select data from various tables like articles, clients, commandes, fournisseur. The queries filter on fields, perform calculations like averages, counts, sums, use functions like concat, like, between, order by, group by, having, subqueries and joins.

Uploaded by

W Po
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

SQL> select NomFournisseur from fournisseur;


2.SQL> select VilleClient from clients;
3.SQL> select * from clients where VilleClient='casablanca';
4.SQL> select * from articles where poids_article>500;
5.SQL> select * from articles where prix_vente>=prix_achat*2 ;
6.SQL> select * from articles where couleur_article='rouge'AND poids_article>100;
7.SQL> select * from articles where couleur_article='rouge' or poids_article>500;
8.SQL> select * from articles where couleur_article!='rouge' AND
poids_article<=500;
9.SQL> select * from articles where (couleur_article='rouge' and
poids_article>100) or couleur_article='verte';
10.SQL> SELECT * FROM articles WHERE prix_vente BETWEEN 100 AND 150;
11.SQL> select * from articles where couleur_article='rouge'or
couleur_article='verte';
12.SQL> select * from clients where PrenomClient LIKE'A%';
13.SQL> select * from clients where PrenomClient LIKE'O__a%';
14.SQL> select * from articles where couleur_article is null;
15.SQL> select * from articles order by poids_article ASC;
16.SQL> select * from articles where poids_article<=100 order by poids_article ASC,
prix_achat DESC;
17.SQL> select (prix_vente - prix_achat) as marge_beneficiaire from articles where
prix_achat > 100 ORDER BY marge_beneficiaire;
18.SQL> select CONCAT(PrenomClient,NomClient) as nom_complet from clients where
VilleClient='casablanca';
19.SQL> select AVG(poids_article) AS poids_moyen FROM articles;
20.SQL> select MAX(prix_vente) AS prix_article_plus_cher FROM articles;
21.SQL> select COUNT(DISTINCT couleur_article) AS nombre_couleurs FROM articles;
22.SQL> select couleur_article, AVG(prix_vente) AS prix_vente_moyen FROM articles
GROUP BY couleur_article ORDER BY couleur_article;
23.SQL> select couleur_article, AVG(prix_vente) AS prix_vente_moyen FROM articles
WHERE prix_achat IS NOT NULL GROUP BY couleur_article ORDER BY couleur_article;
24.SQL> select couleur_article from articles group by couleur_article having
AVG(prix_vente)>100;
25.SQL> select nom_article from articles where code_categorie =(select
code_categorie from articles where nom_article ='Agrafeuse' and nom_article!
='Agrafeuse');
26.SQL> select * from articles where prix_vente > (select AVG(prix_vente) from
articles) ORDER BY prix_vente DESC;
27.SQL> select NomClient, VilleClient from clients where VilleClient = (select
VilleClient from clients where PrenomClient like'%A%');
28.SQL> select nom_article from articles where code_categorie = 'Informatique';
29.SQL> select * from articles where (prix_vente-prix_achat)> (select
AVG(prix_vente-prix_achat) from articles);
30.SQL> select * from articles where prix_achat = (select prix_achat from articles
where nom_article = 'Lampe') OR stock = (select stock from articles where
nom_article = 'Lampe');
31.SQL> select NomClient, PrenomClient from clients where Codeclient IN (select
Codeclient from commandes where numbre_colis > (select AVG(numbre_colis) from
commandes));
32.select NomClient, PrenomClient from clients where Codeclient IN (select
Codeclient from commandes where articles = (select commandes from articles where
nom_article = 'Calculatrice'));
33.SQL> select * from commandes where date_commande ='10/1/24';
34.SQL> select SUM(prix_total) from commandes;
35.SQL> select Nomfournisseur from fournisseur where CodeFournisseur IN (select
CodeFournisseur from articles where code_categorie = 'Électronique');
36.SQL> select * from articles where prix_vente > (select AVG(prix_vente) from
articles where code_categorie = (select code_categorie from articles where
nom_article = 'Agrafeuse'));
)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy