DSCI550: Data Science at Scale Homework 4 Spring 2024SQL

Java Python DSCI550: Data Science at Scale

Homework 4, Spring 2024

1. (30 pts) Explain what requirements this ER diagram is implementing. List the requirements (what the database is for, main focus of the database, explain entities and relationships) in plain sentences.

2. (40 pts) Draw a full ER diagram for the following requirements:

The university database stores details about university students, courses, the semester a student took a particular course (and his mark and grade if he completed it), and what degree program each student is enrolled in. Consider the following requirements list:

• The university offers one or more programs.

• A program is made up of one or more courses.

• A student must enroll in a program.

• A student takes the courses that are part of her program.

• A program has a name, a program identifier, the total credit points required to graduate, and the year it commenced.

• A course has a name, a course identifier, a credit point value, and the year it commenced.

• Students have one or more given names, a surname, a student identifier, a date of birth, and the year they first enrolled. We can treat all given names as a single object—for example, “John Paul.”

• When a student takes a course, the year and semester he attempted it are recorded. DSCI550: Data Science at Scale Homework 4 Spring 2024SQL When he finishes the course, a grade (such as A or B) and a mark (such as 60 percent) are recorded.

• Each course in a program is sequenced into a year (for example, year 1) and a semester (for example, semester 1).

Make it clear to mark primary key, relationships (1-to-1, 1-to-N, N-to-M), and participation (partial and total).

3. (30 pts) Using the following tables in the movie database, write SQL queries.

● Actor (id, fname, lname, age, gender, nationality)

● Movie (id, name, year, rank, revenue, studio, director_id)

● Director (id, fname, lname, gender, income)

id column in ACTOR, MOVIE & DIRECTOR tables is a key for the respective table.

1) (3 pts) List all the male actors (i.e., gender = ‘M’).

2) (3 pts) Find the actor whose first name is ‘John’ and from ‘Spain’.

3) (3 pts) List first name and last name of all the actors whose nationality is ‘USA’.

4) (3 pts) List the name and revenue of movies made by “Universal Studio”.

5) (3 pts) List the total number of movies released in 2018.

6) (3 pts) List max income of all directors.

7) (4 pts) List the name of movies in descending order of revenue, i.e., the highest first.

8) (4 pts) List the average income of female directors.

9) (4 pts) List the names and years of the movies directed by “Jeniffer” (fname)         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值