Question

In: Computer Science

Create first draft for online shopping database (SQL): Things to do: Identify the entities Identify the...

Create first draft for online shopping database (SQL):
Things to do:

Identify the entities

Identify the attributes

Constraints

Relations

First Normal form

Second Normal Form

Third Normal Form

Test Query to:

Add a new item as a seller

Query for total number of sold item in past month

Query for total income in US DOLLARS

Solutions

Expert Solution

Background explanation:

Database:

A database is a coherent collection of data with some ingerent meaning, designed, built and populated woth data for a specific purpose. In the given case, it is an online shopping database.

Database Management System:

A Database Management System or DBMS is the software system that allows users to define, create and maintain a database and provides controlled access to the data. In the given case, the control to the database is done by SQL.

SQL:

SQL which stands for Structured Query Language, is a domain specific language used in programming and designed to manage data held in a relational data stream management system.

First draft for the online shopping database:

The initial draft for an online shopping database using SQL is designed through the following steps while emphasising on all the detailed requirements as given in the question, however it is worthwhile to mention that this might not be the final and complete model for the entire online shopping DBMS:

A. Identifying the entities:

The major entities of online shopping DBMS are identified as below:

1. The Market (M)

2. The Products (P)

3. The customers or Buyers (B)

4. The suppliers or Sellers (S)

5. The Shopping Cart (C)

6. The Order (O)

7. The Payment (P)

8. The Delivery (D)

9. The customer review or Feedback (F)

10. The discount or Rebate (R)

It is ssumed that the delivery of the product is arranged by the seller directly to the buyer through a courier of their choice and so courier is not part of this module.

Identifying the attributes:

The major attributes for each of the above are identified as follows:

1. The Market (M): the buyer id, seller id, products id, rebate id, shopping cart id, order id, payment id, delivery id

2. The Products (P): product id, name, price, rebate, seller, buyer (optional)

3. The customers or Buyers (B): buyer id,login password, name, address, zip/pin code, email id, mobile no

4. The suppliers or Sellers (S):seller id,login password, name, address, zip/pin code, email id, mobile no

5. The Shopping Cart (C):cart id, buyer id, product id, price, rebate, date, time

6. The Order (O): order id, buyer id, cart id, product id, price, rebate, date, time

7. The Payment (P): payment id, order id, buyer id, seller id, date, time

8. The Delivery (D): delivery id, order id, buyer id, seller id, date, time

9. The customer review or Feedback (F):feedback id, buyer id, product id, comment, date, time

10. The discount or Rebate (R): rebate id, product id, seller id, buyer id  (optional)

The Constraints:

The constraints of the dbms design are listed below:

1. All the attributes listed above are identified by their unique integer identifier or id which can not be null or void

2. The buyers, sellers, products and rebate have to be registered in the market before they start to operate

3.The delivery of the product is arranged by the seller directly to the buyer through a courier of their choice and so courier is not part of this module

4. The customers can optionally provide feedback for any specific product after purchase and delivery

The relations:

The relationships among the attributes are shown in the following ER diagram:

Market

Buyer Product Seller

            

Shopping Cart   Order    Payment Delivery

     

   MarketFeedback Buyer

First Normal Form:

The First Normal form or 1 NF is the property in the relation of a dbms whereby each attribute contains only indivisible atomic values and the value of each attribute contains only a single value from that domain. In this case each of the attributes listed above can be uniquely identified by their respective id values as their primary key and hence the dbms is in 1NF.

Second Normal Form:

The Second Normal Form or 2 NF is the property in the relation of a dbms whereby it is in 1 NF and all non key attributes are functionally dependent on the primary key. In this case,  the dbms is in 1NF and each of the non key attributes listed above are functionally dependent on their primary key or id and hence the dbms is in 2NF.

Third Normal Form:

The Third Normal Form or 3 NF is the property in the relation of a dbms whereby it is in 2 NF and all non prime attributes have no transitive functional dependency. In this case,  the dbms is in 2 NF and there is no transitive functional dependency of the non prime attributes listed above and hence the dbms is in 3 NF.

The 3 test queries can be implemented as folows:

1. Add a new item as a seller:

Syntax: INSERT INTO product

new product id, product name, price, rebate, seller id

2. Query for total number of sold item in past month:

Syntax: SELECT COUNT ( seller id ) FROM order

WHERE seller id = my_id AND date = last month

3. Query for total income in US DOLLARS:

Syntax: SELECT SUM ( price-rebate ) FROM order

WHERE seller id = my_id

This concludes the discussion and brief outline of all the subparts of the question on online shopping DBMS and additional attributes like delivery tracking, multiple payment options and gateways etc can be builton top of this module in the future to make it more robust.


Related Solutions

Create the following SQL queries using the lyrics database below 1. List the first name, last...
Create the following SQL queries using the lyrics database below 1. List the first name, last name, and region of members who do not have an email. 2. List the first name, last name, and region of members who do not have an email and they either have a homephone ending with a 2 or a 3. 3. List the number of track titles that begin with the letter 's' and the average length of these tracks in seconds 4....
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based on your entities defining The attributes within each table The primary and foreign keys within each table *****Show your database tables, tables attributes, primary and foreign keys***** Do not forget to check the lesson slides and videos that show you how to convert an ER/EER into a database schema, and how to create a database and tables using MS SQL Server.
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft Access, Oracle, or MySQL) as indicated by your professor. After creating the database – populate it with some data (could be made up). SQL syntax and the DB application will be discussed and taught in class. This is the final deliverable of the group project. Assignment is due by the due date as indicated by your professor. *Make sure to submit the completed database...
Database - SQL - Operations CS 203 Discrete Structure 2 Create a Microsoft Access Database consisting...
Database - SQL - Operations CS 203 Discrete Structure 2 Create a Microsoft Access Database consisting of the following two tables: Part_needs and Parts_Inventory Part_needs Supplier Part_number Project 23 1092 1 23 1101 3 23 9048 4 31 4975 3 31 3477 2 32 6984 4 32 9191 2 33 1001 1 Parts_Inventory Part_number Project Quantity Color_code 1001 1 14 8 1092 1 2 2 1101 3 1 1 3477 2 25 2 4975 3 6 2 6984 4 10...
SQL code Create entities (tables) to represent the following ternary relationship. Note that we are not...
SQL code Create entities (tables) to represent the following ternary relationship. Note that we are not storing all the required information in these entities to simplify it. The underlined attributes are the primary keys. Don’t forget to set the constraints for primary and foreign keys: •A student entity ( bannerId, first name, last name, date of birth) •A course entity ( crnNumber, course name, # of credits) •An examination entity ( examId, exam_type, exam_date). (exam types can be “Midterm”, “Final”,...
Create a database design with the following rules. List down all the entities and attributes and...
Create a database design with the following rules. List down all the entities and attributes and draw out the relationships. List all the business rules. 1. A person can have multiple accounts (Track individual accounts, Trusts, IRA, 401k, HSA, etc) a. Not all accounts must be through brokerage 2. Multiple brokerages (Fidelity, Vanguard, ect) a. Multiple accounts with different brokerages b. Multiple types of accounts allowed at each broker 3. Categorization of investments (Large Cap, mid cap, small cap, Bonds...
Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
Need SQL commands for these questions based on the bowling league database; When was the first...
Need SQL commands for these questions based on the bowling league database; When was the first tournament date and where was it played? What are the number of tournaments per location?
Use the following information to create SQL commands to retrieve data from Henry Books database :...
Use the following information to create SQL commands to retrieve data from Henry Books database : For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name. For each book published by Plume, list the book code, book title, and price. List the book title, book code, and price of each book published by Plume that has a book price of at least $14. List the book code, book title, and...
Please write the SQL statement for the following. I am using the Adventurework2014 database. 1. Create...
Please write the SQL statement for the following. I am using the Adventurework2014 database. 1. Create a login for AdventureWorks employees. An employee login should be composed of the first letter of a person's first name combined with their last name. In addition, the login should be all lower case characters. All the required information is located in Person.Person table. Employees can be identified by "EM" value in the PersonType field. The output should include BusinessEntityID, first name (FirstName), last...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT