---
# System prepended metadata

title: ItC MySQL Homework

---

ItC MySQL Homework
===
National Taiwan University
Introduction to Computer
2019 Fall - MySQL Online Homework

- TAs
> [name=Yu-Kai Huang]
> [name=Kuang-Yu Jeng]
- Instructor
> [name=Winston Hsu]

---

# Introduction
MySQL is a relational database management system. You are asked to learn basic queries in MySQL. In this homework, there are $5$ questions, $20\%$ per question, and you need to fill in each of the corresponding queries.
1. What planets did Princess Leia visit in movie 3?
2. Who visited planets of his/her affiliation in movie 2?
3. Find all characters that never visited any empire planets.
4. How many times for each character to visit his/her homeworld? show character names and times appeared in TimeTable.
5. For each movie, which character(s) visited the highest number of planets?

Note that ``what planets`` is to list the planet names, ``Who`` and ``Find all characters`` are to list the character names, and ``For each movie, which character`` is to list the movie number and character name in pairs.

# Database
We use the [star war](https://www.starwars.com/databank) database containing three files: ``TimeTable.csv``, ``Characters.csv`` and ``Planets.csv``
- ``TimeTable.csv`` records for each character and movie, what planet and when did the character go to.
- ``Characters.csv`` contains for each character, what is his/her homeworld and affiliation.
- ``Planets.csv`` records the information about each planet.

# MySQL Environment
To save your time, we don't asked you to build SQL environment in Linux system from scratch. Instead, you can use <cite>[Paiza.io][1]</cite> that TAs have pre-built to test online.
- [TA pre-built link](https://paiza.io/projects/zxmcIG7d6WzIEGLppDqr-g?language=mysql)
- Notes about TAs pre-built environment
    - TAs pre-built environment includes loading database and exercises for you to get used to the SQL queries.
    - **DO NOT MODIFY** anything TAs provided, TAs preserve the right to deduct your scores if violate.
    - Please **make copy of your link and codes** when using Paiza. TAs are not responsible for your lost of codes online.
- If you are interested in how to build environment on your own, please refer to [homwork](https://github.com/amjltc295/SQL_Homework) last year. Also, there are more queries for you to practice.

---

# Submission
- Data structure, name your school ID with upper case for the first character
    ```
    R08922053/
    ├── Main.sql
    └── R08922053.txt
    └── output.txt
    ```
    - ``R08922053.txt`` contains your submitted Paiza link and only one line.
    - ``Main.sql`` is the copy of your Paiza SQL codes.
    - ``output.txt`` is the file downloaded from ``https://out.paiza.io/projects/[your link hash]/output.txt``, which can be clicked (![](https://i.imgur.com/UArF8ZZ.png =12x) button) from the bottom right corner of the output console. **Do not copy and paste the content. Please do download it from the URL.**
- **Zip** the file directory and submit to Ceiba
- DO NOT CHANGE anything of your link content after submission.
- You are responsible for any rules violated.

# Judgement
- TAs would use the [judge](https://github.com/kaikai4n/ItC-MySQL-auto-judge) to auto-judge your score
- Any rule you violated might cause you to get zero point.
- Kindly remind that you should test with auto-judge before submission.


# Acknowledgement
Thanks <cite>[Paiza.io][1]</cite> for providing good environment of MySQL for students to use.

[1]: https://paiza.io/en