MySQL SQL 视图作业代写、SQL View 语句代写、SAS、R代写

MySQL SQL 视图作业代写、SQL View 语句代写
Rules
1. Submission format: For each question, type your answer into a text file named qN.sql, where N is the question number. Then, create a ZIP file, containing all those files. We will run your queries (mysql -D imdb < qN.sql) and compare the results against reference answers. Also, include a text file student.txt containing your information (see below). Therefore, if you answer all questions, then your ZIP file should contain a total of 13 text files (q1.sql through q12.sql, plus student.txt).
2. Every submission must clearly indicate your name, student ID number, NetID, and the homework number.
Include this information in a textfile in your submitted ZIP file.
3. Submissions must be done individually.
4. If you work in a group, you must identify your group members in each submission. There is a limitation of three people per group for the bonus points.
IMDB database
This database contains information about just over 10,000 movies. The data is derived from IMDB and Rotten Tomatoes, and was originally made available by the HetRec 2011 workshop on recommender systems.
The movieID is an integer which uniquely identifies each movie (the IDs are arbitrarily assigned, and do not have any “real-world” meaning; their only purpose is to serve as primary keys ). All other attributes are fairly self-explanatory. Rating and score information is retrieved from Rotten Tomatoes. Ratings are averages, in the range 0–10 for critics and 0–5 for audiences. The Rotten Tomatoes fresh/rotten are in the range 0–100. The movieactors.rank attribute indicates the order that an actor’s name appears in the movie credits. Sometimes, the same actor is billed twice in the same movie (presumably under different roles). Surprisingly, there are also movies were all actors are ranked 1st (some are big-name star vehicles).
Facebook database
This database contains information about close to 26,000 Facebook users. The data was collected by Panos Ipeirotis around 2006, when Facebook was still a young website, running a PHP frontend over a MySQL backend (both technologies that it still uses, and which you’ll get to briefly play with in the last homework assignment), with little in the way of privacy controls.
The uid (user ID) field is an integer that uniquely identifies each user. All users in this database are affiliated with NYU (either as students, alumni, or staff). The main table is users, containing user profile information (or NULL, if a user has not submitted that information). Fields from the original table which could directly identify a person have been removed in this version of the dataset (e.g., last names have been stripped out, street names, numbers, and zipcodes have been removed from all address fields, and AIM usernames have been deleted). All other tables contain additional profile information, such likes (books, movies, music, and TV shows) and interests, relationship status, and concentration/major of study. Most of this should be self-explanatory. Note that the in field in the interestedin table is a SQL reserved word, so you need to enclose it in backticks in your SQL statements (i.e., write ‘in‘ instead of just in).
Creating views
All questions can be answered without using SQL views. However, if you prefer to do so, you can create them in the test database (since you have read-only access to the imdb database). Therefore, for any views you create, you
will need to use a fully-qualified name, i.e.,
DROP VIEW IF EXISTS test.foo;
CREATE VIEW test.foo AS ...;
SELECT ...
FROM test.foo, movies, ...;
You must, however, make sure that the last statement in your .sql file is the SELECT that produces your answer; otherwise the automated tests will fail.
Testing website and scoreboard
Once you have created your submission zipfile, you can submit it for testing against reference anwers via. Your zipfile does not need to contain all answers (you will get an error message if a file is missing just for that file, but other tests will run), so you can quickly test individual queries. However, for complete scoring, you do need to upload a zipfile with all your answers. Please remember that filenames in the zipfile are case sensitive (i.e., Q1.SQL is not the same as q1.sql). The reference answer will not be shown to you, but you will be informed if there are mismatches. This is the same set of tests we will use for grading. Remember that passing all tests successfully is not a guarantee that your queries are correct (and, therefore, that you will get a perfect grade), but it is a good indication that you are on the right track.
The number of correct answers will be recorded, and shown in a scoreboard. You can change your screen name at any time through the account management page at You still need to submit your solutions via The scoreboard will always show your latest submission, which is not necessarily the one with the highest score.
Leader bonus [35, 20, or 10 points]
The first student (or group, up to three members) to submit a zipfile that gets all questions right will get 35 points bonus. The first and second-runner ups will get 20 and 10 points, respectively. Each submission is logged on the server, even if the scoreboard displays only the latest submission (not the best). Therefore, you do not need to worry if you subsequently upload a submission with missing or incorrect answers.

Part I: Facebook [45 points]
Question 1 – Distinct names [5 points] What is the number of distinct user names?
Question 2 – Status distribution [5 points] Output all possible user.status values (e.g., ‘Undergrad’, etc) along with the number of users for each status, in descending order.
Question 3 – Most popular names [5 points] Output the top-20 user names, ordered by popularity. If there are ties for the 20th position, output all of them (i.e., your “top-20” can have more than 20 names in this case).
Question 4 – Gender-neutral names [5 points] We’ll call a name gender neutral if the set of users that have it contains both males and females. Find all gender-neutral user names, ordered alphabetically.
Question 5 – Gender preferences (1) [5 points] Output the uid, name, and sex of all users that are interestedin the same sex as theirs. Order your output by uid, ascending.
Question 6 – Gender preferences (2) [5 points] Output the uid, name, and sex of all users that are interestedin both ‘Men’ and ‘Women’. Order your output by uid, ascending.
[On your own: Among only these users, what is the gender distribution?]
Question 7 – Gender bending names? [5 points] Now, find the set of gender-neutral names, but only among those users that are interested in both ‘Men’ and ‘Women’; again, order names alphabetically.
[On your own: Is the percentage of gender-neutral names among users interested in both ‘Men’ and ‘Women’ similar to the same percentage over all users?]
Question 8 – Matchmaking [10 points] Find the users that share the most interests with user 830782. Output the uid, name, and count of common interests for those users. Additionally, restrict your output only to users that share at least two interests with 830782, and order the output by descending count, breaking ties by ascending uid.
[On your own: How about finding the top-100 pairs of users with the largest number of common interests? You can restrict your answer to users that are of opposite sex. If you try to run this on the server, please be mindful of your fellow students!!]
Part II: IMDB [55 points]
Question 9 – Active actors [5 points] Return the total number of active actors in the database. An active actor is one whose most recent movie is released after the year 2006 (i.e., year > 2006).
Question 10 – Audience favorites [5 points] Return the number of movies where the audience rating is strictly higher than the critics’ rating. Do not forget to scale the two ratings to the same range (i.e., either multiply audience ratings by two, or divide critic ratings by two).
Question 11 – Contentious directors [5 points] Return the directors’ name that have made movies which were rated higher by audiences than critics, as well as movies which were rated higher by critics than audiences. Again, do not forget to scale ratings to the same range. Sort the results in ascending order of name.
Question 12 – Cruise collaborators [5 points] Return the actors’ name who have collaborated with ‘Tom Cruise’ in the largest number of movies. If there is a tie, sort by name in ascending order.
Question 13 – Most popular actors [5 points] Find the top-10 active actors (as defined in Question 9) whose movies receive the most audience ratings in total. For example, if ‘Tom Hanks’ had played in three movies, whose audience numratings are 30, 20, and 10 respectively, then the total number of ratings of his movies would be 30+20+10=60.
Question 14 – Contentious directors revisited [10 points] Similar to Question 11, but each director should have at least 5 movies rated higher by audiences and at least 5 rated higher by critics. Output the directors’ name, numhigherbyaudience, numhigherbycritics and sort the results in descending order of numhigherbyaudience + numhigherbycritics, breaking ties in ascending order of name.
Question 15 – Modern directors’ favorites [10 points] Find all actors who have acted in four or more movies by the same director since 2005. Output actorname, directorname, nummoviestogether, ordering results first by number of movies in descending order and breaking ties by actor’s name.
Question 16 – Dual favorite movies [10 points] One analyst wants to find a set of all-time best movies. He considers two metrics at the same time: its audiencerating and the number of ratings audiencenumratings. The analyst uses the following rule to determine whether one movie is better than another: For two movies textttm1 and m2, we define that m1 dominates m2 if and only if m1 has a higher average rating and m1 receives more ratings.
Find a set of movies’ title, audiencenumratings, audiencerating, so that each movie in this set is not dominated by any other movie in the database. Return the output in ascending order of title. [This type of query is also known as a skyline query.]
http://www.6daixie.com/contents/15/1328.html

我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全  汇编语言 硬件编程 软件设计 工程标准规等。其中代写代做编程语言或工具包括但不限于以下范围:

C/C++/C#代写

Java代写

IT代写

Python代写

辅导编程作业

Matlab代写

Haskell代写

Processing代写

Linux环境搭建

Rust代写

Data Structure Assginment 数据结构代写

MIPS代写

Machine Learning 作业 代写

Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导

Web开发、网站开发、网站作业

ASP.NET网站开发

Finance Insurace Statistics统计、回归、迭代

Prolog代写

Computer Computational method代做

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codinghelp

猜你喜欢

转载自www.cnblogs.com/studentabroad/p/8969854.html
今日推荐