FAQ: Code Challenges - Code Challenge 14

This community-built FAQ covers the “Code Challenge 14” exercise from the lesson “Code Challenges”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Node-SQLite

FAQs on the exercise Code Challenge 14

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

It’s very infuriating when you follow the instruction and still get an error just to ask for the solution and find that there were instructions missing. In this exercise they never mention ANY reference to what to do with the information they ask you to retrieve, yet in order to have a correct answer, you need to add a callback function. Instructions shouldn’t lack such specificity.

4 Likes

Any idea why this wouldn’t work?

db.get("SELECT traffic FROM TrainStation WHERE station_id = 38 AND month = $month;", {
  $month: new Date().getMonth();
}, (err, row) => {
  console.log(row.traffic)
})
1 Like

yeah! I was trying the same … and keep getting an error!
solution -> they just wanted to write the month name directly to the query …

Especially with something like this where dates can have such wild formats it’d be nice to at least have a console so we can look to figure it out ourselves.

Current month could be 8 as an integer, ‘08’ as a string, ‘AUG’, ‘Aug’, 'AUGUST, or ‘August’ and all are valid.

When is printQueryResults() the correct option over console.log()?

This is actually way better, thanks for sharing your code!