Posts beating their author's average

SQLHard13 min

Your task

Return published posts whose views exceed the average views of that author's published posts. Give title and views, ordered 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