Query tweater (3)
假设您有一张包含一堆信息的 people 表。这次,您想要找出已婚男性的 age 和 country。已知有一列 married,当此人已婚时取值为 1,那么下面的查询就可以实现:
SELECT age, country
FROM people
WHERE gender = "male" AND married = 1
您能否用类似的方法,在 tweater 数据库上编写一个更有针对性的查询?
本练习是课程的一部分
R 数据导入进阶
练习说明
- 创建一个 R 数据框
specific,它从comments表中 选择message列,条件是tweat_id等于 77 且user_id大于 4。 - 打印
specific。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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 specific
# Print specific