title: "mp4"
author: "Dasom An & Janell Lin"
output: html_document
library(mdsr)
library(RMySQL)
db <- dbConnect_scidb(dbname = "imdb")
sql <- "
SELECT t.id, t.title, t.production_year, mii.info AS votes, mii2.info AS rating, movie_id
FROM title t
JOIN movie_info_idx mii ON mii.movie_id = t.id
JOIN movie_info_idx mii2 ON mii2.movie_id = t.id
WHERE t.kind_id = 1
AND mii.info_type_id = 100
AND mii2.info_type_id = 101
AND mii.info > 100000
ORDER BY mii2.info desc;
"
best_movies <- db %>%
dbGetQuery(sql)
head(best_movies)
best_movies100 <- best_movies %>%
head(100)
sql_2 <- "SELECT n.name, ci.role_id, person_id, ci.id, movie_id
FROM cast_info ci
JOIN name n ON n.id = ci.person_id
WHERE role_id = '8'
AND gender = 'f';
"
peopleF_info <- db %>%
dbGetQuery(sql_2)
head(peopleF_info)
sql_3 <- "SELECT n.name, ci.role_id, person_id, ci.id, movie_id
FROM cast_info ci
JOIN name n ON n.id = ci.person_id
WHERE role_id = '8'
AND gender = 'm';
"
peopleM_info <- db %>%
dbGetQuery(sql_3)
head(peopleM_info)
title: "mp4" author: "Dasom An & Janell Lin" output: html_document