Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChi Ian Wong
Courses Plus Student 35 Pointsnew database in same activity
HI, I want to create an app that has a calendar view, and by clicking dates I go to my second activity which is passed extra data (the date ) and it is a list of food they consumed which can be manually added or deleted, so I save it in sql database. How to implement this so that every date will have a new list specific for that day and saved (probably a new database?) Do I have to create a new database in the second activity which has the name passed on from the main activity so that it is a unique database for that day or does it work in another way? Thank you so much
1 Answer
Ben Deitch
Treehouse TeacherHey Chi!
I'd probably go with 1 database with 1 table in it. And that table would have a date column and a food column. Then when you want to figure out which foods were eaten on a specific day, you can just:
SELECT *
FROM <table_name>
WHERE <date_column_name> = <the_date_you're_interested_in>
Chi Ian Wong
Courses Plus Student 35 PointsChi Ian Wong
Courses Plus Student 35 Pointsor should I store the date in one database and call all food that is related to that date?