Assignment 2
CIS2002 Database Design and Implementation
Semester 3, 2020
Student id: 0061124521
SECTION A (Advanced Data Modelling)
List of Relations
- Edge Cloud Computing (IS-A) Customer
- Edge Cloud Computing (IS-A) OLTP
- Edge Cloud Computing (IS-A) OLAP
- Edge Cloud Computing (IS-A) OLAP (HAS-A) Database One
- Edge Cloud Computing (IS-A) OLTP (HAS-A) Database One
- Edge Cloud Computing (IS-A) OLTP (HAS-A) Customer
- Edge Cloud Computing (IS-A) OLAP (HAS-A) Customer
Edge Cloud Computing (IS-A) Customer:
List of Attributes
- Name (PK)
- Address, E-Mail
- Telephone
- Processing Bandwidth
- Type of Service
- Duration of Use.
- –Processing Specialty (FK)
Edge Cloud Computing (IS-A) OLTP
List of Attributes
- Data Downloads
- Data Uploads
- Point of Sales
- Social Media
- Accounting
Edge Cloud Computing (IS-A) OLAP
List of Attributes
- Image Processing
- Business Intelligence
- Forecasting
- Predicting and Recognition
Edge Cloud Computing (IS-A) OLAP (HAS-A) Database One :
List of Attributes
- Name
- Make
- Model
- Year
- MAC Address
- Location
- Site IP Address
- Processing Specialty (FK)
Edge Cloud Computing (IS-A) OLTP (HAS-A) Database One:
List of Attributes
- Name
- Make
- Model
- Year
- MAC Address
- Location
- Site IP Address
- Processing Specialty (FK)
CREATE TABLE Database_One (
Name varchar(255),
Make varchar(255),
Model varchar(255),
Year int,
Mac Address int,
Location varchar(255),
Site IP Address int,
Processing Specialty varchar(255),
PRIMARY KEY (Name),
FOREIGN KEY (Processing Specialty)
);
SECTION B (Normalization)
Freight Office (Freight id # Branch name, address, opening hours, office contact, total cargo, receiver id#, destination id#)
item(item_id# ,Freight id#, category, package, weight, dimensions, ship-by date, receive-by date, sender_id#)
sender (sender id#, Item_id#, sender name, sender contact, contact address))
Receiver (receiver id#, Item_id#, receiver name, receiver contact, receiver address)
Destination (Destination id#, destination country code, destination state, destination city, distribution Centre, distribution contact)
Table names, primary key and foreign key after converting to 3NF Form-
Table Name | Primary Key | Foreign key |
Freight Office | Freight_id | receiver id, destination id |
item | Item_id | Freight_id, sender_id |
sender | Sender_id | Item_id |
Receiver | Receiver_id | Item_id |
Destination | Destination id |
SECTION C (Advanced SQL)
- select books.title ,orderitems.quantity from books inner join orderitems on orderitems.isbn =books.isbn where orderitems.paideach-books.cost/books.cost>.30
Output Screenshot
- select books.category,publisher.name from books inner join publisher on books.pubid=publisher.pubid where books.category=”COMPUTER” or books.category= “FAMILY
LIFE”
Output Screenshot
- select category ,count(isbn) as counts from books group by category having counts> 1;
Output Screenshot
- select title ,isbn,cost from books group by category having count(isbn)<2 order by title;
Output Screenshot
select category ,round( (retail-discount-cost)/count(isbn) )as AVERAGE_CATEGORY_PROFIT,STDEV( (retail-discount-cost)/count(isbn) ) as SDV_PROFIT from books group by category order by AVERAGE_CATEGORY_PROFIT ;
Output Screenshot
- select retail,name,id,category from books join orderitems on orderitems.isbn =books.isbn group by category having count(quantity)>3
The post CIS2002 Database Design and Implementation appeared first on My Assignment Online.