Coding task · SQL and MySQL course · Module 8: Subqueries

Price and average side by side

Place a scalar subquery on the SELECT column list to show the average next to each book's price.

Task

Write a query that retrieves from the ksiazki table the tytul, cena columns and - as an extra column aliased srednia - the result of the scalar subquery (SELECT AVG(cena) FROM ksiazki). Place the subquery on the column list in SELECT.