I am using Drupal 7 and I want to create tables which have primary key and foreign keys using content types. Each table would be created using content types. Let's say, when I create Fruit content type, it should create a table for it, right? Then, I may have Price table, hence, I create a Price content type. Now, the Fruit id(primary key) should be connected with Fruit id in the Price table (content type). How's this possible? I don't know how to code the tables/content type schema.

Thanks for your help.

  • It would be great to have this feature. I always think it's backward to make a db abstraction layer that removes functionality and makes things inefficient just to help in the one off chance you'll ever want to change your database back end... Apr 3, 2012 at 10:04

2 Answers 2


Following link has a long discussion about foreign key in Groups.Drupal

=> Add join/foreign key info to schema

  • yep, it's a good discussion. not v. satisfactory, and it ended in 2009. Apr 3, 2012 at 10:03

I think this is what you want: References Module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.