BaşlayınÜcretsiz başlayın

List the database tables

After you've successfully connected to a remote MySQL database, the next step is to see what tables the database contains. You can do this with the dbListTables() function. As you might remember from the video, this function requires the connection object as an input, and outputs a character vector with the table names.

Bu egzersiz, kursun bir parçasıdır

Intermediate Importing Data in R

Kursa Göz Atın

Egzersiz talimatları

  • Add code to create a vector tables, that contains the tables in the tweater database. You can connect to this database through the con object.
  • Display the structure of tables; what's the class of this vector?

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Load the DBI package
library(DBI)

# Connect to the MySQL database: con
con <- dbConnect(RMySQL::MySQL(), 
                 dbname = "tweater", 
                 host = "courses.csrrinzqubik.us-east-1.rds.amazonaws.com", 
                 port = 3306,
                 user = "student",
                 password = "datacamp")

# Build a vector of table names: tables


# Display structure of tables
Kodu Düzenle ve Çalıştır