Jump to content

Foreign Key explination


synking

Recommended Posts

Hey everyone.  Thought i would ask on here cuz i don't seem to be understanding it.

 

I am trying to setup a system where people input ideas to improve a project.  Each idea is supposed to go through certain stages of approval or denial.  I have one table that store all the ideas.  which looks like

DESCRIBE ideas;
+----------+--------------+------+-----+---------+----------------+
| Field    | Type         | Null | Key | Default | Extra          |
+----------+--------------+------+-----+---------+----------------+
| Id       | int(5)       | NO   | PRI | NULL    | auto_increment |
| Date     | date         | NO   |     | NULL    |                |
| Email    | varchar(255) | NO   |     | NULL    |                |
| Name     | text         | YES  |     | NULL    |                |
| Headline | text         | YES  |     | NULL    |                |
| Problem  | text         | YES  |     | NULL    |                |
| Promise  | text         | YES  |     | NULL    |                |
| Proof    | text         | YES  |     | NULL    |                |
| Threats  | text         | YES  |     | NULL    |                |
| Passion  | text         | YES  |     | NULL    |                |
| Cost     | text         | YES  |     | NULL    |                |
| Value    | text         | YES  |     | NULL    |                |
| Purpose  | text         | YES  |     | NULL    |                |
+----------+--------------+------+-----+---------+----------------+
13 rows in set (0.01 sec)

 

Which i am trying to assign a foreign key too so that the status of them can be related to a seperate table.  But my issue is im not sure if that is the best way to do it... Should i just add another column to this table for the status and not worry about creating a second table.  If i do create a second table what is the best way to handle the foreign key relationship.

 

Just trying to get ideas thanks guys

Link to comment
Share on other sites

I'd probably just add another column myself... But 'status' for me is usually limited to 'Complete', 'In Progress', or 'Not Started'

 

It really depends on how flexible you need to be with your status. Generally, if you only have a few different options it's not worth it to move over to a foreign key.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.