0
There is an error.
You are working with a library database that stores data on books. The Books table has the columns id, name, year, author_id. The author_id column connects to the Authors table, which stores the id, name columns for the book authors. You need to select all the books with their authors, ordered by the author name alphabetically, then by the year in ascending order. The result set should contain only 3 columns: the book name, year and its author (name the column author). SELECT Books.name AS book_name, Books.year, Authors.name AS author FROM Books, Authors WHERE Books.author_id = Authors.id ORDER BY Authors.name ASC, Books.year ASC; The Test Case is not working fine.
3 Answers
+ 2
Please be specific what sort of error you are facing, don't let people guess.
I believe it is the final task in SQL Intermediate, Multiple Tables.
The description says:
The result set should contain only 3 columns: the book name, year and its author (name the column author).
It asks for a column named as author, as you did, but it didn't ask to rename the book name column...
0
Can you help me with the code?SELECT Books.name AS book_name, Books.year, Authors.name AS author
FROM Books,Authors
WHERE Books.author_id = Authors.id
ORDER BY Authors.name ASC, Books.year ASC;
This is the code.
0
Div Anand
I already gave you a hint in previous answer.
More specifically, only one column has to rename, but you renamed two.