Part 1
1

Chapter 2 :
Trier les données

Exemple du chapitre Trier les données : Example SQL n°2

The questions should help you understand the code shown below.
Once you hold the solution, you can view the answer by clicking on the question title.

1.Comparez la requête de l'exemple précédent et celle-ci. Que constatez vous ?

R : Les livres sont classés dans l'ordre décroissant des prix.

2.Quelle est l'instruction qui a permis de classer dans l'ordre décroissant ?

R : ORDER BY nom_du_champs DESC. Ici ORDER BY prix DESC.
Validated example
SELECT * 
FROM Livres 
ORDER BY prix DESC;
Table Auteurs (auid, nom)
Primary key : auid

Table Editeurs (edid, nom, adresse)
Primary key : edid

Table Livres (isbn, titre, prix, edid, date_edition)
Primary key : isbn
Foreign key : edid of the table Editeurs
Table Livres_auteurs (auid, isbn)
Foreign key : isbn of the table Livres, auid of the table Auteurs
Table stock (id, isbn, id_librairie, nbre_exemplaire)
Primary key : id
Foreign key : isbn of the table Livres

Request 1
isbn
titre
prix
edid
date_edition
744
JavaScript 1.3
55
1
2016-03-02
855
Dictionnaire
44
3
2016-05-05
856
Les noms propres
43
3
2016-05-04
215
Hypérion
7
1
2016-02-01
214
La chute d'Hypérion
7
1
2016-01-03
548
Les misérables
7
2
2016-02-11
547
Notre dame de Paris
7
2
2016-04-04
0x0
Journal Interne
3
3
2016-04-03
2 / 5
Exemple du chapitre Trier les données