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 trialRoxanne Reyes
9,006 PointsThere's something wrong with this challenge. BUMMER IT'S NOT WORKING!
I've tried changing my code to answer the question, but it's not working for some reason. I know it's got to be right. Can someone help me please? I don't know what I did wrong.
Roxanne Reyes
9,006 PointsCREATE TABLE MEMBERS(ID INT PRIMARY KEY, FIRST_NAME VARCHAR(255), LAST_NAME VARCHAR(255), FAVORITE_ROCK_ID REFERENCES ROCK(ID));
I still have this error coming up saying I need a foreign key constraint.
1 Answer
Peter Vann
36,427 PointsHi Roxanne!
(The Police is my favorite band, so kudos on the cooooool name!)
This passes the first challenge:
CREATE TABLE ROCKS (
ID NOT NULL UNIQUE PRIMARY KEY,
NAME,
TYPE,
COLOR
);
This passes the second:
DROP TABLE MEMBERS;
This passes the third:
CREATE TABLE MEMBERS (
ID NOT NULL UNIQUE PRIMARY KEY,
FIRST_NAME,
LAST_NAME,
FAVORITE_ROCK_ID REFERENCES ROCKS(ID)
);
(And yes, even though they pass, there are still some weird error messages, but I don't understand why they are generated!?!)
More info
https://teamtreehouse.com/community/whats-wrong-with-my-code-here-3
I hope that helps.
Stay safe and happy coding!
Roxanne Reyes
9,006 PointsHi Peter Vann! Thanks for your help. I finally figured out the problem and solved the challenge. And yes the Police is an awesome band and they happened to have a cool song named after me. Every time I meet someone new they always end up singing that song to me. LOL
cgeorge
5,492 Pointscgeorge
5,492 PointsHello Roxanne!
Sorry to hear you're having trouble. I'd love to try and help. Can you provide your code so I can look it over and try to recreate the problem?