Guest User

Untitled

a guest
Apr 24th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. mysql> describe users;
  2. +-------------------------------+---------------------+------+-----+---------+----------------+
  3. | Field | Type | Null | Key | Default | Extra |
  4. +-------------------------------+---------------------+------+-----+---------+----------------+
  5. | user_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
  6. | user_status_id | bigint(20) unsigned | NO | MUL | NULL | |
  7. | profile_id | bigint(20) unsigned | YES | MUL | NULL | |
  8. +-------------------------------+---------------------+------+-----+---------+----------------+
  9.  
  10. mysql> describe multiple_choice_questions;
  11. +----------------------------------+---------------------+------+-----+---------+----------------+
  12. | Field | Type | Null | Key | Default | Extra |
  13. +----------------------------------+---------------------+------+-----+---------+----------------+
  14. | multiple_choice_question_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
  15. | multiple_choice_question_text | varchar(500) | NO | | NULL | |
  16. +----------------------------------+---------------------+------+-----+---------+----------------+
  17.  
  18. mysql> describe multiple_choice_options;
  19. +------------------------------------+---------------------+------+-----+---------+----------------+
  20. | Field | Type | Null | Key | Default | Extra |
  21. +------------------------------------+---------------------+------+-----+---------+----------------+
  22. | multiple_choice_option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
  23. | multiple_choice_option_name | varchar(250) | NO | UNI | NULL | |
  24. | multiple_choice_option_label | varchar(250) | NO | UNI | NULL | |
  25. | multiple_choice_option_description | varchar(500) | NO | | NULL | |
  26. +------------------------------------+---------------------+------+-----+---------+----------------+
  27.  
  28. mysql> describe questions_x_mc_options;
  29. +------------------------------+---------------------+------+-----+---------+----------------+
  30. | Field | Type | Null | Key | Default | Extra |
  31. +------------------------------+---------------------+------+-----+---------+----------------+
  32. | questions_x_mc_option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
  33. | multiple_choice_question_id | bigint(20) unsigned | NO | MUL | NULL | |
  34. | multiple_choice_option_id | bigint(20) unsigned | NO | MUL | NULL | |
  35. +------------------------------+---------------------+------+-----+---------+----------------+
  36.  
  37. mysql> describe multiple_choice_responses;
  38. +---------------------------------+---------------------+------+-----+---------+----------------+
  39. | Field | Type | Null | Key | Default | Extra |
  40. +---------------------------------+---------------------+------+-----+---------+----------------+
  41. | multiple_choice_response_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
  42. | user_id | bigint(20) unsigned | NO | MUL | NULL | |
  43. | multiple_choice_question_id | bigint(20) unsigned | NO | MUL | NULL | |
  44. | multiple_choice_option_id | bigint(20) unsigned | NO | MUL | NULL | |
  45. +---------------------------------+---------------------+------+-----+---------+----------------+
  46.  
  47. SELECT *
  48. FROM multiple_choice_responses
  49. WHERE multiple_choice_question_id NOT IN (
  50. SELECT multiple_choice_question_id
  51. FROM multiple_choice_responses
  52. WHERE user_id = 1
  53. );
Add Comment
Please, Sign In to add comment