library(DBI)
library(dbplyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:dbplyr':
##
## ident, sql
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(odbc)
library(RMySQL)
con <- dbConnect(odbc::odbc(),
.connection_string = "Driver={MySQL ODBC 8.0 Unicode Driver};",
Server = "localhost", Database = "movie_ratings", UID = "root",PWD = "Lassy123",
Port = 3306)
movie_rating <- dbGetQuery(con,"SELECT * FROM movie_ratings.movies")
print (movie_rating)
## MovieID Movie Name 5 - Excellent 4 - Good 3 - Fair
## 1 1 The Dark Knight (2008) 1 4 0
## 2 2 Man of Steel (2013) 2 2 1
## 3 3 Spider-Man: Homecoming (2017) 4 1 0
## 4 4 Avengers: Endgame 2 2 1
## 5 5 Thor: Ragnarok (2017) 0 0 2
## 6 6 Guardians of the Galaxy (2014) 0 3 1
## 2 - Poor 1 - Very Poor
## 1 0 0
## 2 0 0
## 3 0 0
## 4 0 0
## 5 3 0
## 6 1 0
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.