Your task is the following:

  1. (1 %) Create an SQL database using the following data model:


    Remember to use PRIMARY KEY and FOREIGN KEY constraints. 

  2. (2 %) Create INSERT commands to insert the data given in the excel file within Topic 4 -section.

    --- After this point, you can return the assignment at any time for some points if you do not want to do the rest of the homework. Jump to step 7.

  3. (1 %) Add ON DELETE CASCADE to all foreign key constraints.
  4. (2 %)Create a view Comments_of_comments that shows only comments associated with other comments in the following format and order the results by username:
    |User|Comment| Commented on |
  5. (1 + 1 %) Create a trigger hashtag_not_allowed that triggers before data is inserted into Hashtag- table. The trigger should raise an abort printing "Mayonnaise detected!" when hashtag content has the word mayonnaise
  6. (1 + 1 %) Create a view Tweets_and_tags that shows all hashtags with the associated Tweet in the following format and order the results by username:
    |User|Tweet| Hashtag|
  7. Return the sql statements for in one file. Remember to have them in correct order so a table or entity does not reference something that does not yet exist.