I am designing the following application: A job applcation system allowing for students to apply for jobs.
Basically companies can create custom forms that students who are interested in a job with their company, must fill out.
I have the following tables:
// this stores the name of the form that companies want students to fill out:
create table forms (
`id` INT(11),
`company_id` INT(11),
`name` varchar(255),
`date_added` date,
PRIMARY KEY (`id`));
CREATE TABLE form_options
(
`id` INT(11) auto_increment,
`company_id` INT(11),
`form_id` INT(11),
`question` VARCHAR(255),
`active` int(2),
`position` int(4),
`type` enum('ESSAY', 'QUESTION', 'YESNO', 'CHECKBOX', 'DROPDOWN', 'RADIO', 'FILE'),
`required` tinyint(1),
`data` text,
`date_added` date,
PRIMARY KEY (`id`));
form_options stores each question that the company adds to a form (stored in forms table). So let us say that company A creates a form A and wants to ask the following question to students:
How would you describe yourself? A. nice B. responsible C. hardworking D. talented
the following row gets added to the forms table:
forms:
- id: 1
- company_id: 1
- name: form A (name of the form)
- date_added: 2011-12-28
and the following row gets added to the form_option table
- id: 1
- company_id: 1
- form_id: 1
- question: How would you describe yourself?
- active: 1 (Is active question)
- position: 1
- type: RADIO (Company wants this to be a radio button type question)
- required: 1 (YES, question is required.)
- data: {a: nice; b: responsible; c: hardworking; d: talented} (this is a serialized array storing the possible options the student has for the question)
The problem is that there are many companies. When a student applies for a company, they have to fill out the form for that company in addition to the general form (that all students fill out). I am trying to figure out the best way to store the student's answers since each field is different. Like what the best table structure for storing their answers to the company forms would be considering a question could be an essay (TEXT), a radio button list type question (meaning the value is an integer or letter), etc. That means that the student's answer to a form question can be in the form of an essay (500 chars or more), a letter (as an answer to a radio button type question), or a line of text, etc
thanks!