Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> describe users;
- +-------------------------------+---------------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +-------------------------------+---------------------+------+-----+---------+----------------+
- | user_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
- | user_status_id | bigint(20) unsigned | NO | MUL | NULL | |
- | profile_id | bigint(20) unsigned | YES | MUL | NULL | |
- +-------------------------------+---------------------+------+-----+---------+----------------+
- mysql> describe multiple_choice_questions;
- +----------------------------------+---------------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +----------------------------------+---------------------+------+-----+---------+----------------+
- | multiple_choice_question_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
- | multiple_choice_question_text | varchar(500) | NO | | NULL | |
- +----------------------------------+---------------------+------+-----+---------+----------------+
- mysql> describe multiple_choice_options;
- +------------------------------------+---------------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +------------------------------------+---------------------+------+-----+---------+----------------+
- | multiple_choice_option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
- | multiple_choice_option_name | varchar(250) | NO | UNI | NULL | |
- | multiple_choice_option_label | varchar(250) | NO | UNI | NULL | |
- | multiple_choice_option_description | varchar(500) | NO | | NULL | |
- +------------------------------------+---------------------+------+-----+---------+----------------+
- mysql> describe questions_x_mc_options;
- +------------------------------+---------------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +------------------------------+---------------------+------+-----+---------+----------------+
- | questions_x_mc_option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
- | multiple_choice_question_id | bigint(20) unsigned | NO | MUL | NULL | |
- | multiple_choice_option_id | bigint(20) unsigned | NO | MUL | NULL | |
- +------------------------------+---------------------+------+-----+---------+----------------+
- mysql> describe multiple_choice_responses;
- +---------------------------------+---------------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +---------------------------------+---------------------+------+-----+---------+----------------+
- | multiple_choice_response_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
- | user_id | bigint(20) unsigned | NO | MUL | NULL | |
- | multiple_choice_question_id | bigint(20) unsigned | NO | MUL | NULL | |
- | multiple_choice_option_id | bigint(20) unsigned | NO | MUL | NULL | |
- +---------------------------------+---------------------+------+-----+---------+----------------+
- SELECT *
- FROM multiple_choice_responses
- WHERE multiple_choice_question_id NOT IN (
- SELECT multiple_choice_question_id
- FROM multiple_choice_responses
- WHERE user_id = 1
- );
Add Comment
Please, Sign In to add comment