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 trial

Development Tools Database Foundations Joining Relational Data Between Tables in SQL Keys and Auto-Incrementing Values

Daniel Schwemmlein
Daniel Schwemmlein
4,960 Points

don't know whats missing in my constraint

Hello! I guess there is something missing in my syntax or there is something not correct. please help me because I don't know what else could still be missing here

I was supposed to add a foreign table and then make a constraint with two other things

thanks in advance

Could you list the tables you are working with? Could you list your script here?

Daniel Schwemmlein
Daniel Schwemmlein
4,960 Points

So i was supposed to alter the table t_movies by adding the fk_genre_id as a foreign key and have t_genres and Pk_id as references:

This is what i have currently

alter table t_movies add column fk_genre_id integer constraint foreign key(fk_genre_id) references (t_genres, pk_id);