Exercise: SQL INSERTs

Scholars have determined that the anonymous Elizabethan play Edmund Ironside, or War Hath Made All Friends was written by Shakespeare.

Information about this play is available at https://sourcetext.files.wordpress.com/2018/01/1587_edmund_ironside_modern.pdf.

You need to create INSERT statements to add this play and related information to the Shakespeare database. If you are running your own copy of the Shakespeare database (in SQLite or PostGIS), you may do work with your copy. Otherwise, the Shakespeare tables have been duplicated in the gus8067 schema on Kropotkin, and you should test your INSERT statements against those tables. (You do not have INSERT privileges to the tables in the shakespeare schema.)

You will not add anything to the paragraph table. You will add entries to the, character, character_work, and, work tables.

Create one script with all of the inserts that you need.

Because of foreign key constraints, you must add rows to some tables before others. Using the Shakespeare ERD, specify the order of tables. You will not add any data to the chapter or paragraph tables, but do specify what order they should appear in the list. Include the answer to this question in a comment block at the top of your script.

You should make up a legal value for any field that requires an entry, such as totalwords (e.g., 100, or any other integer).

The workid should be “edmund”. The year of publication 1587. Use the title above as the long title, and “Edmund Ironside” as the short title. The genre is history. The source is “Elizabethan”.

All characters listed on the web page should be added. Words that appear after the comma are the descriptions. For example, the first character should have charname set to “Edmund Ironside”, and the description set to “King of the Saxons, son of Ethelred the Unready”. charid may be set to anything you want, but you will have to reenter it in the character_work table, so keep track of it.

Enter all characters in the link table character_work.

Submit one SQL script which can run from start to finish without error.