Escolar Documentos
Profissional Documentos
Cultura Documentos
Oracle SQL
Ifthikar 1629275
Afaz 1629348
Contents
Logical Diagram ............................................................................................................................................. 3
Relational Diagram........................................................................................................................................ 4
QUERIES ........................................................................................................................................................ 5
A. The below imgae is showing the group by function. All category ordering the result by name. ......... 5
B. The below query shows the all the parent category. ........................................................................... 5
C. Category along with parent category ................................................................................................... 6
F. Specific product from a specific category ............................................................................................. 8
G. All Customer who joined in 2017 ......................................................................................................... 8
H. Top 10 orders in year 2016 based on the total amount of order......................................................... 9
L. Final Amount between 2 Days .............................................................................................................. 9
O. Customer’s name who is name starts with “M”. ................................................................................. 9
Q. Retrieve all the payment methods. .................................................................................................... 10
R. Orders which are ready for the delivery. ............................................................................................ 10
S. Orders which were delivered last month............................................................................................ 11
Triggers........................................................................................................................................................ 11
TR1 .......................................................................................................................................................... 11
TR2 .......................................................................................................................................................... 12
TR3 .......................................................................................................................................................... 13
DATA INSERT ............................................................................................................................................... 14
Employee Table ....................................................................................................................................... 14
Customer Table ....................................................................................................................................... 14
Category Table ........................................................................................................................................ 15
Views ........................................................................................................................................................... 16
Sales summary ........................................................................................................................................ 16
Customer summary................................................................................................................................. 17
Sales Report ............................................................................................................................................ 18
Image Captions
Figure 1 - Logical Diagram ............................................................................................................................. 3
Figure 2 - Relational Diagram ........................................................................................................................ 4
Figure 3 - Accessed Sub Category Table ....................................................................................................... 5
Figure 4 - Accessed Product Table ................................................................................................................ 5
Figure 5 - Used Inner Join ............................................................................................................................. 6
Figure 6 - Accessed Product Table ................................................................................................................ 7
Figure 7 - Accessed Prodcut Table ................................................................................................................ 8
Figure 8 - Accessed Customer Table ............................................................................................................. 8
Figure 9 – Accessed Order Table................................................................................................................... 9
Figure 10 - Accessed Order Table ................................................................................................................. 9
Figure 11 - Accessed Customer Table ........................................................................................................... 9
Figure 12 - Accessed Payment Table .......................................................................................................... 10
Figure 13 - Accessed Order Table ............................................................................................................... 10
Figure 14 - Accessed Order Table ............................................................................................................... 11
Figure 15 - Trigger 1 .................................................................................................................................... 11
Figure 16 - Trigger 2 .................................................................................................................................... 12
Figure 17 - Trigger 3 .................................................................................................................................... 13
Figure 18 - Insert Data to Employee Table ................................................................................................. 14
Figure 19 - Insert Data to Customer Table .................................................................................................. 14
Figure 20 - Insert Date to Category Table ................................................................................................... 15
Figure 21 - Sales Summary View ................................................................................................................. 16
Figure 22 - Customer Summary View ......................................................................................................... 17
Figure 23 - Sales Report View ..................................................................................................................... 18
Logical Diagram
This is our system’s Logical Diagram, To get this type diagram we did normalization and finally got this
output.
Relational Diagram
To get this relational diagam, We did forward engineering to get this relational diagram.
QUERIES
A. The below imgae is showing the group by function. All category ordering the result by
name.
Here it shows the categories along with parent category. It allows to see the sub category of each
category.
This retrieve the specific category. To do this we used where clause and we given the data name of
retrieve the output.
The above output shows the specific brand. In here we selected pr_id, pr_name, pr_brand to display the
data.
The above output shows the who joined in 2017, to get this output we used TO_CHAR function.
This can be used in the real time situations, This is very important thing in the system.
The above output shows the top 10 orders in based on the total amount of order. To do this we used
ROWNUM by desc.
This output shows the 2 day’s total order, This done using BETWEEN.
The below output shows whose name is starting with “M”. To get this output we used LIKE operator.
This is much suitable operator to display the name which is starting with “M”.
Using this table we can see the order status of each order.
Here it displays the delivered order which were delivered last month. This helps to see the delivered
order in last month.
Triggers
TR1
Figure 15 - Trigger 1
TR2
Figure 16 - Trigger 2
The above screenshot shows the trigger, Which were created to insert update and delete processes.
TR3
Figure 17 - Trigger 3
This is our 3rd trigger this trigger also created to insert, update and delete, Once this done the record will
store in aud_rec.
DATA INSERT
Employee Table
This is how we inserted data into Employee Table.
Customer Table
This is the way that we inserted data to Customer Table.
Category Table
This is the way that we inserted data to Customer Table.
Views
Sales summary
We created a sales summary.
This view shows the sales details, This gives a overall summary details of sale.
Customer summary
We created a sales summary.
Sales Report