| 7 | | * The script should (re-)create the schema, all the tables, with all constraints, and all other relevant database objects. |
| 8 | | * The script should work in an empty database to fully construct everything needed for the project, and should also work in a database where the schema, tables and other objects are already created and they need to be re-created. So drop existing objects and create them again. |
| 9 | | * The script should be named schema_creation.sql |
| 10 | | * Link the script in this section in the !RelationalDesign wiki page as an attachment to the page. |
| | 10 | {{{#!div style="text-align: justify; width: 100%;" |
| 14 | | * The script should (re-)create all the data in your tables |
| 15 | | * The script should work with empty tables to fully load all needed data for the project, and should also work in a database where the tables already have data and need to be emptied and the data should be imported again. |
| 16 | | * The script should be named data_load.sql |
| 17 | | * Link the script in this section in the !RelationalDesign wiki page as an attachment to the page. |
| | 14 | 2. ADMIN (**__user_id*__**[USER], discount_percentage, type) |
| | 15 | |
| | 16 | 3. CONSUMER (**__user_id*__**[USER], points_collected) |
| | 17 | |
| | 18 | 4. WISHLIST (**__wishlist_id__**, **__user_id*__**[USER]) |
| | 19 | |
| | 20 | 5. PRODUCT (product_id, price, format, description, stock) |
| | 21 | |
| | 22 | 6. RELEASE (release_id, product_id*[PRODUCT]?????, title, release_date, genre, record_label, cover_photo) |
| | 23 | |
| | 24 | 7. ALBUM (release_id*[RELEASE]) |
| | 25 | |
| | 26 | 8. SINGLE (release_id*[RELEASE], duration) |
| | 27 | |
| | 28 | 9. SONG (song_id, song_name, duration) |
| | 29 | |
| | 30 | 10. ORDER (order_id, user_id*[USER], purchase_date, status, payment_method, points_used, points_earned) |
| | 31 | |
| | 32 | 11. ORDER_ITEM (order_id*[ORDER], product_id*[PRODUCT], quantity, price_at_purchase) |
| | 33 | |
| | 34 | 12. ARTIST (artist_id, artist_name, photo, description) |
| | 35 | |
| | 36 | 13. MODIFICATION (modification_id, user_id*[ADMIN], date_modified, discount) |
| | 37 | }}} |
| | 38 | |
| | 39 | |
| | 40 | ==== DDL script for creating the database schema and objects: |
| | 41 | |
| | 42 | ==== DML script for filling tables with data: |