SQL Taskbook Level 8.10 of the SQL task book
The tables are given:
| id | first_name | last_name |
|---|---|---|
| id | first_name | last_name |
| 1 | Jack | Brown |
| 2 | John | Doe |
| 3 | Max | White |
| id | name |
|---|---|
| 1 | IT |
| 1 | PHP |
| 2 | JavaScript |
| 3 | React |
| 4 | Angular |
| 5 | Vue.js |
| 6 | C/C++ |
| 7 | Rust |
| id | title | likes | author_id |
|---|---|---|---|
| 1 | Lorem ipsum | 3810 | 2 |
| 2 | Lorem ipsum dolor sit amet | 1913 | 2 |
| 3 | Lorem ipsum dolor sit | 4111 | 1 |
| 4 | Lorem ipsum dolor | 6700 | 3 |
| id | post_id | tag_id |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 1 | 2 |
| 3 | 1 | 3 |
| 4 | 1 | 4 |
| 5 | 1 | 5 |
| 6 | 2 | 7 |
| 7 | 2 | 6 |
| 8 | 2 | 5 |
| 9 | 2 | 1 |
| 10 | 2 | 3 |
| 11 | 3 | 1 |
| 12 | 3 | 7 |
| 13 | 3 | 5 |
| 14 | 3 | 6 |
| 15 | 4 | 5 |
| 16 | 4 | 1 |
| 17 | 4 | 7 |
| 18 | 4 | 6 |
Solve the following tasks for them:
Find the author with the most tagged posts. Output the author's name, the number of such posts, and a list of these posts.
Find the tags that appear in posts the most times from different authors. Output the name of the tags, the number of unique authors using this tag, and a list of these authors.