Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Bruce McMinn10,030 Points
Subqueries Review & Practice # 1 Clunky Answer
So question 1 asks for a list of all titles and a count of duplicate books. That sounds like a column of words and another column with a single numeric entry. Can I combine these two making a derived table of either?
-- a list of all books, no duplicate titles
SELECT bn.title FROM books_north AS bn
SELECT bs.title FROM books_south AS bs
SELECT bs.title FROM books_south AS bs;
-- a complicated way to get the number 12
SELECT COUNT(*) AS BooksWithMultipleCopies FROM
(SELECT COUNT(*) as book_num
FROM (SELECT title FROM books_north
SELECT title FROM books_south)
GROUP BY title
I'm guessing that there isn't a good join criteria??