Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP9311 23T2:Assignment 1

Deadline: Fri 16:59:59 23rd June (Sydney Time)

Question 1 (9 marks)

An organizer commissioned us to design a database for eCommerce platform. They provide a summary of requirements as below.

•   A seller is identified by his/her seller id. We also record his/her username, password, DoB, phone number and credit score. A seller can manage zero or many stores.

•   A store is identified by its store id. We also record its name, location and contact information. The location is composed of country, city and postal code. A store must be managed by at least one seller.

•   A customer is identified by his/her customer id. We also record his/her username, password, DoB, gender and address. Note a customer may have multiple addresses.

•   A  store  must  sell  one  or  many  products.  A  product  is  identified  by  its product id. We also record its name, type, size and price per unit. Each product must be sold by one store.

•   The  customer  purchases  products  by  placing  an  order.  Each  order  is identified by its id. We also record the timestamp and delivery information.

•   A customer can place zero or many orders. Each order must be placed by one customer. An order must contain one or many products. A product can be included in zero or many orders.

•   Each customer owns at most one cart that gathers all the products he/she wants. A  cart is  identified by its cart id. We also record the number  of products in a cart.

•   A cart must be owned by one customer. A cart may contain zero or many products. A product can appear in zero or many carts.

•   There are many payment methods available (e.g., credit card, gift card, …). A  customer  can  have  zero  or  many  payment  methods.  Each  payment method must be associated with one customer. The payment method is identified by customer id and pm id. We also record its type and account information.

Your task: draw an ER diagram to represent the scenasrio, clearly state any reasonable assumptions that you choose to make. Reasonable relation names are acceptable. Please keep to the notations taught in the lecture.

Question 2 (6 marks)

Your task: convert the above ER-diagram into a relational data model, and please only keep to the notations/model taught in the lecture.

Question 3 (10 marks)

Consider the following schema for post office database:

Post_Office (poID, poName, address, founded_year)

Delivery_Person (dpID, dpName, age, poID)

Customer (cID, cName, age, gender, address)

Parcel (pID, content, weight)

Type (pID, type)

Delivery_Order (cID, dpID, pID, timestamp)

Your task: write the relational algebra expressions for the following queries:

1)  Find the names of Post Offices which were founded before 2005. (2 marks)

2)  Find the names of Delivery Persons who delivered more than 10 Parcels weighing over 2kg during the year 2011. (2 marks)

3)  Find  the names of Customers who have  only  placed  orders  to  deliver Parcels that are both small and fragile at the same time. Note small/fragile refers to the type of Parcel. (3 marks)

4)  Find the names of Post offices where all the delivery persons have only delivered large Parcels but never delivered for any male Customer who is younger than 30. Note large refers to the type of Parcel. (3 marks)

Note: Attributes that are not part of the primary key are not unique. Please keep to the operators/notations taught in the lecture.

Assignment Submission

•   You must submit an electronic copy of their answers to the above questions to the course website in Moodle. You can handwrite your answers and scan or take a photo. Make sure they are legible.

•   We only accept .doc, .docx or .pdf files.

•   Please  name  your  files  in  the  following  format: ass1_studentID.doc or ass1_studentID.pdf (e.g., ass1_z5100000.doc or ass1_z5100000.pdf).

Note:

1.   If you have problems relating to your submission, please write to the course emailzyang@cse.unsw.edu.auoryiheng.hu@unsw.edu.au .

If there are issues with Moodle, send your assignment to the above email with the title <zid> COMP9311 Ass1 Submission”.

2.   All  submissions  will  be  checked  for  plagiarism.  The  university  regards plagiarism as a form of academic misconduct and has very strict rules. Not knowing the  rules  will  not be  considered a valid excuse when you  are caught.

a.   For UNSW policies, penalties, and information to help avoid plagiarism, please see:https://student.unsw.edu.au/plagiarism.

b.   For guidelines in the online ELISE tutorials for all new UNSW students: https://subjectguides.library.unsw.edu.au/elise/plagiarism .

Late Submission Penalty

•   5% of the max mark will be deducted for each additional day (24hr) after the specified submission time and date.

•   Submissions that are more than five days late will not be marked.