Query tweater (4)
There are also dedicated SQL functions that you can use in the WHERE clause of an SQL query. For example, CHAR_LENGTH() returns the number of characters in a string.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Intermediate Importing Data in R
คำแนะนำการฝึกหัด
- Create a data frame,
short, that selects theidandnamecolumns from theuserstable where the number of characters in thenameis strictly less than 5. - Print
short.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Connect to the database
library(DBI)
con <- dbConnect(RMySQL::MySQL(),
dbname = "tweater",
host = "courses.csrrinzqubik.us-east-1.rds.amazonaws.com",
port = 3306,
user = "student",
password = "datacamp")
# Create data frame short
# Print short