Cấp độ 5.9 Bộ bài tập SQL
Cho các bảng:
| id | first_name | last_name | date_of_birth |
|---|---|---|---|
| 1 | John | Smith | 1987-12-12 |
| 2 | Alex | Cooper | 1999-02-20 |
| 3 | Agata | Leyla | 1970-01-30 |
| 4 | Ivan | Ivanov | 1994-05-31 |
| 5 | Peter | Petrov | 1991-08-24 |
| id | title | body | author_id |
|---|---|---|---|
| 1 | Post-1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | 1 |
| 2 | Post-2 | Duis aute irure dolor in reprehenderit in voluptate. | 2 |
| 3 | Post-3 | Sed ut perspiciatis, unde omnis iste natus error. | 2 |
| 4 | Post-4 | Ut enim ad minima veniam, quis nostrum. | 1 |
| 5 | Post-5 | Quis autem vel eum iure reprehenderit. | 3 |
| 6 | Post-6 | Et harum quidem rerum facilis est et expedita. | 3 |
| 7 | Post-7 | Excepteur sint occaecat cupidatat. | 1 |
| 8 | Post-8 | Ullam corporis suscipit laboriosam, nisi ut aliquid. | 1 |
| id | text | user_id | post_id |
|---|---|---|---|
| 1 | Good | 5 | 8 |
| 2 | The best | 3 | 7 |
| 3 | Bad | 1 | 3 |
| 4 | Awful | 2 | 3 |
| 3 | I like it | 3 | 5 |
Hãy giải các bài tập sau cho chúng:
Lấy tên tác giả, tiêu đề bài đăng và bình luận thuộc về bài đăng đó.
Lấy tên tác giả, năm sinh của họ, tiêu đề bài đăng và bình luận thuộc về bài đăng đó. Và id tác giả phải lớn hơn 3.