R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

soal3 <- dbGetQuery(con2, "SELECT
                    o.ordernumber,
                    c.country,
                    SUM(od.quantityOrdered * od.priceEach) AS total_value
                    FROM orders o
                    JOIN orderdetails od ON o.orderNumber = od.orderNumber
                    JOIN customers c ON o.customerNumber = c.customerNumber
                    WHERE c.country IN('Denmark','Finland','Norway','Sweden')
                    GROUP BY o.orderNumber")
soal3
##    ordernumber  country total_value
## 1        10103   Norway    50218.95
## 2        10105  Denmark    53959.21
## 3        10112   Sweden     7674.94
## 4        10141  Finland    29716.86
## 5        10151  Finland    32723.04
## 6        10155  Finland    37602.48
## 7        10158   Norway     1491.38
## 8        10161  Denmark    36164.46
## 9        10167   Sweden    44167.09
## 10       10181 Norway      55069.55
## 11       10188 Norway      29954.91
## 12       10238  Denmark    28211.70
## 13       10239  Finland    16212.59
## 14       10247  Finland    28394.54
## 15       10256  Denmark     4710.73
## 16       10284 Norway      32260.16
## 17       10289 Norway      12538.01
## 18       10291   Sweden    48809.90
## 19       10299  Finland    34341.08
## 20       10301 Norway      36798.88
## 21       10309   Norway    17876.32
## 22       10314  Denmark    53745.34
## 23       10320   Sweden    16799.03
## 24       10325   Norway    34638.14
## 25       10326   Sweden    19206.68
## 26       10327  Denmark    20564.86
## 27       10334   Sweden    23014.17
## 28       10363  Finland    45785.34
## 29       10373  Finland    46770.52
## 30       10377  Finland    23602.90
## 31       10389   Sweden    27966.54
## 32       10406  Denmark    21638.62

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.