~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A4 - SURVEY SEZ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


create table srv_Admins(
	Admin_ID  		int   			unsigned not null auto_increment,
	First_name  		varchar(45) 		default"",
	Last_name   		varchar(45) 		default"",
	Department  		varchar(100) 	default"",
	CONSTRAINT  	ADMIN_PK  		primary key(Admin_ID)
);

create table srv_Surveys(
	Survey_ID  		int   			unsigned not null auto_increment,
	Admin_ID  		int   			unsigned not null,
	Title  			varchar(255) 	default"",
	Description  		text 			default"",
	Date_added   	DATETIME,
	Date_updated  	DATETIME,
	Active_date		DATETIME,
	Inactive_date 	DATETIME,
	Times_viewed 	int  			default 0,
	CONSTRAINT  	SURVEY_PK  	primary key(Survey_ID),
	CONSTRAINT  	ADMIN_FK   		foreign key(Admin_ID)
                        						references srv_Admins(Admin_ID)
                        						on update no action
                        						on delete no action
);

create table srv_Questions(
	Question_ID  	int   			unsigned not null auto_increment,
	Date_updated  	DATETIME,
	Question 		text 			default"",
	CONSTRAINT  	QUESTION_PK  	primary key(Question_ID)
);

create table srv_Surveys_Questions(
	Survey_ID  		int   unsigned not null,
	Question_ID 		int   unsigned not null,
	CONSTRAINT  	SURVEY_QUESTION_PK  		primary key(Survey_ID, Question_ID),
	CONSTRAINT  	Surveys_Questions_Survey_FK   	foreign key(Survey_ID)
                                          								references srv_Surveys(Survey_ID)
                                          								on update no action
                                          								on delete no action,
	CONSTRAINT  	Surveys_Questions_Question_FK   	foreign key(Question_ID)
                                            								references srv_Questions(Question_ID)
                                            								on update no action
                                            								on delete no action
);

create table srv_Answers(
	Answer_ID  			int   			unsigned not null auto_increment,
	Question_ID  		int   			unsigned not null,
	Date_updated  		DATETIME,
	Type 				varchar(45) 		default"",
	Answer 			text 			default"",
	Number_responses  	int 			default 0,
	CONSTRAINT  		ANSWER_PK  	primary key(Answer_ID),
	CONSTRAINT  		QUESTION_FK   	foreign key(Question_ID)
                          							references srv_Questions(Question_ID)
                          							on update no action
                          							on delete no action
);
