SQL Taskbook Level 8.8 of the SQL task book
The tables are given:
| 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 | 4 |
| 10 | 2 | 3 |
| 11 | 3 | 2 |
| 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 who has the most unique tags in their posts and display their name, the number of unique tags, and a list of those tags.
Find the tag that is present in all posts by the author with the highest total number of likes on his posts. Output the tag name, the author's name, and the total number of likes on his posts.