Question du test SQL - Les bases

Écrire une requête SQL pour récupérer les titres des livres écrits par 'John Smith'.

Facile

Étant donné les tables 'authors' et 'books' suivantes :

authors:
| author_id | name       |
|-----------|------------|
| 1         | John Smith |
| 2         | Jane Doe   |

books:
| book_id | title          | author_id |
|---------|----------------|-----------|
| 1       | My First Book  | 1         |
| 2       | Another Book   | 1         |
| 3       | A Great Novel  | 2         |

Quelle requête SQL permet de récupérer le titre des livres écrits par 'John Smith' ?

Auteur: Vincent CotroStatut : Publiée(Mise à jour)Question passée 347 fois
Modifier
3
Évaluations de la communauté
developer avatar
sara
27/02/2024
SELECT title FROM books WHERE author_id = (SELECT author_id FROM authors WHERE name = 'John Smith') this one is also correct
developer avatar
Auteur anonyme
27/02/2024
Merci sara
developer avatar
Auteur anonyme
29/02/2024
Hello, n'hésitez pas à publier une version corrigée de cette question ;)