Skip to content

Atiqa N. - #18

Open
atiqanaseer wants to merge 2 commits into
HackYourAssignment:mainfrom
atiqanaseer:main
Open

atiqanaseer wants to merge 2 commits into
HackYourAssignment:mainfrom
atiqanaseer:main

Conversation

@atiqanaseer

Copy link
Copy Markdown

No description provided.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

@rafasilpereira rafasilpereira left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done on delivering this assignment!

Task 1 is well done and with good queries implementations. I would only pay attention about details about the requirements for the questions and thiking how we would do this queries with a larger data quantity.

Task 2 is working properly and as expected! I would like to understand better the use of maps and casting, curious to see what motivated this choise!

Comment thread task-1/queries.sql
-- **Question 2** — Show every book published before 1950. Display the title and year only.

SELECT title, published_year FROM books
WHERE published_year < 50;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only show very old books less than year 50, and that's why this query doesn't return results. Did you try with 1950?

Comment thread task-1/queries.sql
SELECT b.title, b.published_year
FROM books b
JOIN authors a ON a.id = b.author_id
WHERE a.first_name || ' ' || a.last_name = 'Stephen King'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one on choosing using concatenation in WHERE!

Comment thread task-1/queries.sql
-- **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, published_year, genre, author_id)
VALUES ('Sunset Rose', '2026', 'Romance', 25);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! A challenge: there is a way of doing a SELECT to find the author_id. How would you do that? Tip: I can add doing something like ...VALUES('Rafael', 'Pereira', (SELECT id FROM customers)) ;)

Comment thread task-1/queries.sql
-- **Question 7** — The genre for "The Dark Tower: The Gunslinger" was entered incorrectly as `'Fantasy'`. It should be `'Horror'`. Write an UPDATE to fix it, then verify the change with a SELECT.
UPDATE books
SET genre = 'Horror'
WHERE title = 'The Dark Tower: The Gunslinger';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one here! Adding exactly the title for UPDATE or DELETE and avoiding using LIKE makes you changing one what is needed, without the risk of updating or deleting not wanted rows

Comment thread task-1/queries.sql
-- **Question 8** — Delete the book you added in Question 6. Make sure your query targets only that specific row.

DELETE FROM books
WHERE id = 101;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would write this if you don't know the id to be deleted?

Comment thread task-2/migrate.js
const migrate = db.transaction(() => {
// Clear existing rows so the migration can be re-run safely.
db.prepare('DELETE FROM cards').run();
db.prepare('DELETE FROM decks').run();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good approach on deleting before!

Comment thread task-2/src/database.js
.run(name, description);

return {
id: Number(info.lastInsertRowid),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using casting in this row?

Comment thread task-2/src/database.js
)
.all(deckId);

return rows.map(card => ({ ...card, learned: Boolean(card.learned) }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose to map and cast the returns in this line?

@rafasilpereira rafasilpereira added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed Review in progress labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants