付録B練習問題の解答

3章

3-1
俳優全員の俳優ID、ファーストネーム、ラストネームを取得し、最初はラストネームで、続いてファーストネームで並べ替えてみよう。
mysql> SELECT actor_id, first_name, last_name
    -> FROM actor
    -> ORDER BY 3,2;
+----------+-------------+--------------+
| actor_id | first_name  | last_name    |
+----------+-------------+--------------+
|       58 | CHRISTIAN   | AKROYD       |
|      182 | DEBBIE      | AKROYD       |
|       92 | KIRSTEN     | AKROYD       |
|      118 | CUBA        | ALLEN        |
|      145 | KIM         | ALLEN        |
|      194 | MERYL       | ALLEN        |
......
|       13 | UMA         | WOOD         |
|       63 | CAMERON     | WRAY         |
|      111 | CAMERON     | ZELLWEGER    |
|      186 | JULIA       | ZELLWEGER    |
|       85 | MINNIE      | ZELLWEGER    |
+----------+-------------+--------------+
200 rows in set (0.00 sec)
3-2
ラストネームが'WILLIAMS'または'DAVIS'に等しい俳優全員の俳優ID、ファーストネーム、ラストネームを取得してみよう。
mysql> SELECT actor_id, first_name, last_name ...

Get 初めてのSQL 第3版 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.