CREATE TABLE mcq_results (
	mcq_result_id int NOT NULL,
	resource_id int NOT NULL,
	user_id int NOT NULL,
	available int NOT NULL,
	deductions int NOT NULL,
	wrong int NOT NULL,
	correct int NOT NULL,
	when_done TIMESTAMP NOT NULL ,
	when_marked TIMESTAMP NOT NULL ,
	CONSTRAINT PK_mcq_results PRIMARY KEY
	(
		mcq_result_id
	),
	CONSTRAINT FK_mcq_result_to_objects FOREIGN KEY
	(
		mcq_result_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_mcq_result_to_resources FOREIGN KEY
	(
		resource_id
	) REFERENCES resources (
		resource_id
	),
	CONSTRAINT FK_mcq_result_to_users FOREIGN KEY
	(
		user_id
	) REFERENCES users (
		user_id
	)
)
GO


INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(31,	'building2', 'mcq_results', 'org.bodington.assessment.McqResult')
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 1, 'mcq_result_id', 'setMcqResultId', 'getMcqResultId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 1, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 2, 'resource_id', 'setResourceId', 'getResourceId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 3, 'user_id', 'setUserId', 'getUserId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 4, 'available', 'setAvailable', 'getAvailable', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 5, 'deductions', 'setDeductions', 'getDeductions', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 6, 'wrong', 'setWrong', 'getWrong', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 7, 'correct', 'setRight', 'getRight', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 8, 'when_done', 'setWhenDone', 'getWhenDone', 'java.sql.Timestamp', 'java.sql.Timestamp', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(31, 8, 'when_marked', 'setWhenMarked', 'getWhenMarked', 'java.sql.Timestamp', 'java.sql.Timestamp', 0, null, null, null )
GO



