Install RMySQL package to connect to MYSQL DBMS

#install.packages("RMariaDB")
library(DBI)

Create a Database Connection object

List the tables in movies database

dbListTables(con)
## [1] "dates"    "gross"    "movies"   "ratings"  "theaters"

Read and display the contents of each table in the movies database

dbReadTable(con,"movies")
##    movieID                               title
## 1        1                     Black Panther\r
## 2        2            Avengers:Affinity Wars\r
## 3        3                     Incredibles 2\r
## 4        4    Jurassic World: Fallen Kingdom\r
## 5        5                           Aquaman\r
## 6        6                        Deadpool 2\r
## 7        7              Dr Seuss' The Grinch\r
## 8        8      Mission Impossible - Fallout\r
## 9        9              Ant Man and the Wasp\r
## 10      10           Solo: A Star Wars Story\r
## 11      11                    BlackKKlansman\r
## 12      12 Spider Man: Into the Spider Verse\r
## 13      13                              Roma\r
## 14      14                     A Quiet Place\r
## 15      15                    A Star is Born\r
## 16      16                       Padington 2\r
## 17      17                      Eighth Grade\r
## 18      18              Call me by your name\r
dbReadTable(con,"gross")
##    id     gross movieId
## 1   1 700059566       1
## 2   2 678815482       1
## 3   3 608581744       1
## 4   4 417719760       1
## 5   5 328547042       1
## 6   6 318491426       1
## 7   7 270534960       1
## 8   8 220159104       1
## 9   9 216648740       1
## 10 10 213767512       1
## 11 11  48686605       1
## 12 12 179821627       1
## 13 13         0       1
## 14 14 188024361       1
## 15 15 208735869       1
dbReadTable(con,"ratings")
##    id rating movieId
## 1   1     97       1
## 2   2      0       1
## 3   3     93       1
## 4   4     47       1
## 5   5     65       1
## 6   6     83       1
## 7   7      0       1
## 8   8     97       1
## 9   9     88       1
## 10 10     70       1
## 11 11     96       1
## 12 12     97       1
## 13 13     96       1
## 14 14     95       1
## 15 15     89       1
## 16 16    100       1
## 17 17     99       1
## 18 18     95       1
dbReadTable(con,"theaters")
##    id theatres movieId
## 1   1     4084       1
## 2   2     4474       1
## 3   3     4410       1
## 4   4     4485       1
## 5   5     4184       1
## 6   6     4349       1
## 7   7     4141       1
## 8   8     4395       1
## 9   9     4206       1
## 10 10     4381       1
## 11 11     1914       1
## 12 12     3813       1
## 13 13        0       1
## 14 14        0       1
## 15 15     3904       1
dbReadTable(con,"dates")
##    id            openDt            closeDt movieId
## 1   1 February 16, 2018     August 9, 2018       1
## 2   2    April 27, 2018 September 13, 2018       1
## 3   3     June 15, 2018  December 13, 2018       1
## 4   4     June 22, 2018    October 4, 2018       1
## 5   5 December 21, 2018  December 31, 2018       1
## 6   6      May 18, 2018   October 18, 2018       1
## 7   7  November 9, 2018  December 31, 2018       1
## 8   8     July 27, 2018   October 18, 2018       1
## 9   9      July 6, 2018   November 1, 2018       1
## 10 10      May 25, 2018 September 20, 2018       1
## 11 11   August 10, 2018  December 31, 2018       1
## 12 12 December 24, 2018  December 31, 2018       1
## 13 13 November 21, 2018  December 31, 2018       1
## 14 14     April 6, 2018  December 31, 2018       1
## 15 15   October 5, 2018  December 31, 2018       1