This Assignment assumes you have installed the software MySQL on your computer. If not, please do that first!
- Practice the concepts
- Prep exercises
- MySQL exercises
- Keep practicing (Optional)
Let's do some interactive exercises first. In the following online course, do sections 3 (Aggregate Functions) and sections 4 (Multiple Tables).
Also make time to do lesson 6-12 from the following:
Prep exercises are exercises that you should work on before the session on Sunday. These are a little more difficult or show an important concept and as such are a great exercise to talk about with your mentor. Have a solution ready by Sunday as you may be asked to show what you did.
The QA_PREP_EXERCISE.md file explains what needs to be done for the prep exercise this week. There will also be some questions at the bottom to think about. Go through them before the session on Sunday as it will be covered then.
You will need to do some research to solve these exercises. All the concepts necessary to solve these exercises are NOT covered in the reading material. This is on purpose.
This week we'll practice some more with writing SQL queries using JavaScript. For each exercise make a separate .js
file; make sure to give it an appropriate name!
- Create a table, called
authors
. Give it the following fields:(author_id(Primary Key), author_name, university, date_of_birth, h_index, gender)
- Write a query that adds a column called
mentor
toauthors
table that references the columnauthor_id
. For integrity add aforeign key
on this column.
- Create another table, called
research_Papers
with the following fields:(paper_id, paper_title, conference, publish_date, ...)
- What is the relationship between Authors and Research papers ? Make necessary changes to
authors
andresearch_Papers
tables and add more tables if necessary. - Read exercises 3 and 4 and then add information (insert rows) of 15 authors and 30 research papers such that all queries in the exercises 3 and 4 will return some answers
- Write a query that prints names of all
authors
and their correspondingmentors
. - Write a query that prints all columns of
authors
and their publishedpaper_title
. If there is an author without anyresearch_Papers
, print the information of thatauthor
too.
Write some queries to retrieve the following rows:
- All research papers and the number of authors that wrote that paper.
- Sum of the research papers published by all female authors.
- Average of the h-index of all authors per university.
- Sum of the research papers of the authors per university.
- Minimum and maximum of the h-index of all authors per university.
It is always good to keep practicing, so if you have time then have a go at the following:
After you've finished your todo list it's time to show us what you got! The assignment that needs to be submitted is the following:
- MySQL exercises
Upload both to your forked Databases repository in GitHub. Make a pull request to HackYourFuture's forked repository.
Forgotten how to upload your Assignment? Go through the guide to learn how to do this again.
Deadline Tuesday 23.59 CET