Each post's share of its author's views

SQLHard13 min

Your task

For each published post, return title, views, and pct_of_author, which is its views as a percentage of that author's total published views, rounded to one decimal. Order by title.

Tables

author
idINTEGERnameTEXTcountryTEXT
1NiaKE
2OzAU
3PiaBR
4QuinNULL
post
idINTEGERauthor_idINTEGERtitleTEXTpublished_onTEXTviewsINTEGER
11Indexes explained2026-01-104200
21Query plans2026-02-021800
32Vacuum and bloat2026-02-11900
43Draft on locksNULL0
52Replication lag2026-03-015300
comment
idINTEGERpost_idINTEGERauthor_idINTEGERbodyTEXT
112Useful
213Thanks
312One more thing
431Good write-up
553Saved me