Jawad A.#8
Conversation
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
remarcmij
left a comment
There was a problem hiding this comment.
Hi @jivvyjams, some minor issues in task-1. In task 2, I sense some use of AI agents, which makes it a bit more difficult for me to assess your work.
| (id, title, published_year genre, author_id) | ||
| VALUES (101, 'SQL for Beginners', 2026, 'Non-fiction', 25); |
There was a problem hiding this comment.
- This SQL statement produces a syntax error because of a missing comma.
- The
bookstable has an AUTOINCREMENT clause. It will generate anidfor you. You should not create it yourself, as this may conflict with auto-generated IDs.
| (id, title, published_year genre, author_id) | |
| VALUES (101, 'SQL for Beginners', 2026, 'Non-fiction', 25); | |
| (title, published_year, genre, author_id) | |
| VALUES ('SQL for Beginners', 2026, 'Non-fiction', 25); |
| (id, first_name, last_name, nationality, birth_year) | ||
| VALUES (25, 'Jawad', 'Al Bdiwi', 'Syrian', '1994'); |
There was a problem hiding this comment.
The authors table has an AUTOINCREMENT clause. It will generate an ID for you. You should not create it yourself, as this may conflict with auto-generated IDs.
| (id, first_name, last_name, nationality, birth_year) | |
| VALUES (25, 'Jawad', 'Al Bdiwi', 'Syrian', '1994'); | |
| (first_name, last_name, nationality, birth_year) | |
| VALUES (Jawad', 'Al Bdiwi', 'Syrian', '1994'); |
| SELECT * FROM books WHERE genre = 'Science Fiction' | ||
| ORDER BY published_year DESC; |
There was a problem hiding this comment.
For better readability, place the WHERE clause on a separate line.
| SELECT * FROM books WHERE genre = 'Science Fiction' | |
| ORDER BY published_year DESC; | |
| SELECT * FROM books | |
| WHERE genre = 'Science Fiction' | |
| ORDER BY published_year DESC; |
| -- Display the title and year only. | ||
|
|
||
| -- **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 title, published_year FROM books WHERE published_year < 1950; |
| SELECT title, published_year | ||
| FROM books b | ||
| INNER JOIN authors a ON b.author_id = a.id | ||
| WHERE a.last_name = 'King' |
There was a problem hiding this comment.
What if the database contains other authors with the last name of "King"?
| // This file now uses SQLite instead of JSON | ||
|
|
||
| import { readFileSync, writeFileSync } from 'fs'; | ||
| import Database from 'better-sqlite3'; |
There was a problem hiding this comment.
Why did you change storage.js? The task only asked you to implement database.js.
| // This file handles all reading and writing of data. | ||
| // Currently it uses a JSON file on disk. | ||
| // In the assignment you will replace each function here with a SQLite query. | ||
| // This file now uses SQLite instead of JSON |
There was a problem hiding this comment.
Was this comment added by an AI agent?
| ); | ||
| } | ||
|
|
||
| console.log('✅ Migration done!'); No newline at end of file |
There was a problem hiding this comment.
Looks perfect. Maybe too perfect to be completely your own work? Note that AI tools love inserting emojis.
| FOREIGN KEY (deck_id) REFERENCES decks(id) | ||
| ); | ||
|
|
||
| SELECT * FROM decks; |
| } | ||
| const info = db.prepare('DELETE FROM cards WHERE id = ?').run(cardId); | ||
| return info.changes > 0; | ||
| } No newline at end of file |
There was a problem hiding this comment.
This works fine, but I get the impression that you got a helping hand from an AI agent.
No description provided.