| | 1 | = Relational Design for Handcraft Marketplace= |
| | 2 | |
| | 3 | == Notation == |
| | 4 | |
| | 5 | * Primary keys are bolded and underlined. |
| | 6 | * Foreign keys are marked with `*` at the end of their name and the referenced entity is written in parentheses. |
| | 7 | * Complex attributes are bolded, and their containing attributes are following the, made italic. |
| | 8 | * Multivalued attributes have their own table |
| | 9 | |
| | 10 | == Tables == |
| | 11 | |
| | 12 | 1. **PRODUCT** (**__{{{code}}}__**, {{{price}}}, {{{availability}}}, **{{{dimensions}}}**, ''{{{weight}}}'', ''{{{width_X_length_X_depth}}}'', {{{aprox_production_time}}}, {{{description}}}) |
| | 13 | * image (multi-valued attribute, see table **COLORS**) |
| | 14 | * color (multi-valued attribute, see table **IMAGE**) |
| | 15 | |
| | 16 | 2. **IMAGE** (__**{{{product_code*}}}**__ (PRODUCT), __**{{{image}}}**__) |
| | 17 | |
| | 18 | 3. **COLOR** (**__{{{product_code*}}}__** (PRODUCT), **__{{{color}}}__**) |
| | 19 | |
| | 20 | 4. **STORE** (**__{{{store_ID}}}__**, {{{name}}}, {{{date_of_founding}}}, {{{physical_address}}}, {{{store_email}}}, {{{rating}}}) |
| | 21 | |
| | 22 | 5. **PERSONAL** (**__{{{SSN}}}__**, **{{{name}}}**, ''{{{first_name}}}'', ''{{{last_name}}}'', {{{email}}}, {{{password}}}) |
| | 23 | * permissions (complex, multi-valued attribute, see table **PERMISSIONS**) |
| | 24 | |
| | 25 | 6. **PERMISSIONS** (**__{{{personal_SSN*}}}__** (PERSONAL), **__{{{type}}}__**, {{{authorisation}}}) |
| | 26 | |
| | 27 | 7. **BOSS** (**__{{{boss_SSN*}}}__** (PERSONAL)) |
| | 28 | |
| | 29 | 8. **EMPLOYEES** (**__{{{employee_SSN*}}}__** (PERSONAL), {{{date_of_hire}}}) |
| | 30 | |
| | 31 | 9. **CLIENT** (**__{{{client_ID}}}__**, **{{{name}}}**, ''{{{first_name}}}'', ''{{{last_name}}'', {{{email}}}, {{{password}}}) |
| | 32 | * delivery_address (multi-valued attribute, see table **DELIVERY_ADDRESS**) |
| | 33 | |
| | 34 | 10. **DELIVERY_ADDRESS** (**__{{{client_ID}}}__** (CLIENT), **__{{{address}}}__**) |
| | 35 | |
| | 36 | 11. **ORDER** (**__{{{order_num}}}__**,{{{client_ID*}}} (CLIENT), {{{quantity}}}, {{{status}}}, {{{last_date_mod}}}, {{{payment_method}}}, {{{discount}}}) |
| | 37 | |
| | 38 | 12. **REPORT** (**__{{{date}}}__**, {{{overall_profit}}}, {{{sales_trend}}}, {{{marketing_growth}}}, {{{owner_signature}}}) |
| | 39 | * monthly_profit (multi-valued attribute, see table **MONTHLY_PROFIT**) |
| | 40 | |
| | 41 | 13. **MONTHLY_PROFIT** (**__{{{report_date*}}}__** (REPORT), **__{{{store_ID*}}}__** (REPORT), {{{month_and_year}}}, {{{profit}}}) |
| | 42 | |
| | 43 | 14. **REQUEST** (**__{{{request_num}}}__**, {{{date_and_time}}}, {{{problem}}}, {{{notes_of_communication}}}, {{{costumer_satisfaction}}}) |
| | 44 | |
| | 45 | 15. **MAKES_REQUEST** (**__{{{client_ID*}}}__** (CLIENT), **__{{{order_num*}}}__** (ORDER)) |
| | 46 | |
| | 47 | 16. **ANSWERS** (**__{{{request_num*}}}__** (REQUEST), **__{{{personal_SSN*}}}__** (PERSONAL)) |
| | 48 | |
| | 49 | 17. **FOR_STORE** (**__{{{request_num*}}}__** (REQUEST), **__{{{store_ID*}}}__** (STORE)) |
| | 50 | |
| | 51 | 17. **REVIEW** (**__{{{order_num*}}}__** (ORDER), {{{comment}}}, {{{rating}}}, {{{last_mod_date}}}) |
| | 52 | |
| | 53 | 18. **CHANGE** (**__{{{date_and_time}}}__**, **{{{changes_made}}}**, ''{{{previous_version}}}'', ''{{{new_version}}}'') |
| | 54 | |
| | 55 | 19. **MAKES_CHANGE** (**__{{{personal_SSN*}}}__** (PERSONAL), **__{{{change_date_time*}}}__** (CHANGE)) |
| | 56 | |
| | 57 | 20. **MADE_ON** (**__{{{product_code*}}}__** (PRODUCT), **__{{{change_date_time*}}}__** (CHANGE)) |
| | 58 | |
| | 59 | 21. **WORKS_IN_STORE** (**__{{{personal_SSN*}}}__** (PERSONAL), **__{{{store_ID*}}}__** (STORE)) |
| | 60 | |
| | 61 | 22. **WORKED** (**__{{{personal_SSN*}}}__** (PERSONAL), **__{{{report_date*}}}__** (REPORT), **__{{{store_ID*}}}__** (REPORT), {{{wage}}}, {{{pay_method}}}, **{{{working_hours}}}**, ''{{{total}}}'', ''{{{total_week}}}'') |
| | 62 | |
| | 63 | 23. **SELLS** (**__{{{product_code*}}}__** (PRODUCT), **__{{{store_ID*}}}__** (STORE), {{{discount}}}) |
| | 64 | |
| | 65 | 24. **INCLUDES** (**__{{{order_num*}}}__** (ORDER), **__{{{product_code*}}}__** (PRODUCT)) |
| | 66 | |
| | 67 | 25. **APPROVES** (**__{{{boss_SSN*}}}__** (BOSS), **__{{{report_date*}}}__** (REPORT), {{{owner_signature}}}, **__{{{store_ID*}}}__** (REPORT)) |
| | 68 | |
| | 69 | 26. **EXCHANGES_DATA** (**__{{{report_date*}}}__** (REPORT), **__{{{store_ID*}}}__** (STORE), {{{monthly_profit}}}, {{{date}}}, {{{sales}}}, {{{damages}}}, {{{store_ID*}}} (REPORT)) |
| | 70 | * store_ID is also added as a regular attribute because it is being included in the report. This is necessary as reports made by different stores, on the same day need to be differentiated. |
| | 71 | |
| | 72 | === DDL скрипта за креирање и бришење на табелите === |
| | 73 | |
| | 74 | [wiki:ddlScript.sql DDL скрипта] |
| | 75 | |
| | 76 | === DML скрипта за полнење на табелите со податоци === |
| | 77 | |
| | 78 | [wiki:dmlScript.sql DML скрипта] |
| | 79 | |
| | 80 | === Релациски дијаграм изваден од DBeaver === |
| | 81 | [[Image(DBeaverExportVer2.png)]] |