Hamed R. - #13
Hamed R.#13HamedRazizadeh-hub wants to merge 2 commits into
Conversation
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
rafasilpereira
left a comment
There was a problem hiding this comment.
Well done on finishing the assigment! 👏 👏
Task 2 has a very clear and solid code and works as expected.
Task 1 also has good queries, but some improvement points on getting the results.
Happy to help you if you have any doubt about my comments!
| SELECT title, published_year | ||
| FROM books | ||
| WHERE published_year < 1950; | ||
| ORDER BY published_year ASC; |
There was a problem hiding this comment.
You finished the query before with a ; and then you have the ORDER BY not linked with the previous line, that would cause an error. And the question doesn't ask for ordering ;)
| -- **Question 4** — List all books written by Stephen King. Show the title and published year, ordered by year. _(Hint: JOIN the two tables and filter on the author's name.)_ | ||
| SELECT | ||
| books.title, | ||
| authors.first_name || ' ' || authors.last_name AS author |
There was a problem hiding this comment.
Very good written query, but the question asks for title and published year ;)
| -- **Question 6** — Add one book for the author you just inserted. It can be a real book or a made-up one. | ||
| INSERT INTO books (title, author_id, genre, published_year) | ||
| VALUES ('Freedom For IRAN', | ||
| (SELECT id FROM authors WHERE first_name = 'Hamed' AND last_name = 'Razizadeh'), 'Documentary', 2026); |
There was a problem hiding this comment.
👏 👏 Very good option on choosing SELECT to get the id. Imagine that you a have a big database with a lot of lines. Than this saves time to search the specific id
|
|
||
| --- | ||
| DELETE FROM books | ||
| WHERE id = 101; |
There was a problem hiding this comment.
How would write this if you don't know the id to be deleted?
| -- These cover topics slightly beyond the core material. Have a go if you finish early. | ||
|
|
||
| -- **Bonus A** — How many books are there per genre? Show the genre name and the count, ordered from most to fewest books. | ||
| SELECT genre, COUNT(*) AS book_count |
There was a problem hiding this comment.
👏 Good choise on using alias here!
| @@ -21,23 +21,35 @@ const db = new Database(DB_FILE); | |||
|
|
|||
| export function getAllDecks() { | |||
| // TODO: return all rows from the decks table | |||
There was a problem hiding this comment.
👏 Great use of TODO! How was your choise of using? You first wrote them and then you write the code later? Usually developers commit TODO to point a change that is necessary later in future. So as you developed all items, you can remove the TODO comments :D
No description provided.