# Beginner question: primary and foreign keys

**URL:** <https://forum.kirupa.com/t/beginner-question-primary-and-foreign-keys/283538>\
**Category:** Uncategorized\
**Created:** [March 7, 2009, 6:18pm UTC](https://forum.kirupa.com/t/beginner-question-primary-and-foreign-keys/283538 "2009-03-07T18:18:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaplanyo](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@kaplanyo](https://forum.kirupa.com/u/kaplanyo)\
**Post date:** [March 7, 2009, 6:18pm UTC](https://forum.kirupa.com/t/beginner-question-primary-and-foreign-keys/283538/1 "2009-03-07T18:18:54Z")

</div>

I would like to know if it’s a bad idea to not use the primary key from one table as the foreign key in another. What if I use a different field as the foreign key. Is it still a foreign key?

Maybe I can explain more… if I have a table called ‘projects’ with a field called ‘project\_id’ (the primary key) and ‘name’… is it a bad idea to use ‘name’ as my foreign key in another table, i’m calling project\_images. Project\_images has a field called ‘item\_id’ (the primary key) and ‘project\_name’. I want to use ‘name’ from ‘projects’ and put it into ‘project\_name’ in the ‘project\_images’.

Thanks. Any advice would be really great. I can also post a link or take some screen shots to show what I mean.  
Dave

I’m using:  
MySQL client version: 5.0.22  
Used PHP extensions: mysql
