MySQL: Difference between revisions

From 22112
Jump to navigation Jump to search
Line 13: Line 13:
== Exercises ==
== Exercises ==
<!-- Exercises are ready, but not shown - for reasons.....
<!-- Exercises are ready, but not shown - for reasons.....
-->
'''1)'''
'''1)'''
In /home/projects/pr_course there are 3 files: persons.csv, marriage.csv and disease.csv. That is data that corresponds to the database design exercise 2 last week.
In /home/projects/pr_course there are 3 files: persons.csv, marriage.csv and disease.csv. That is data that corresponds to the database design exercise 2 last week.
Line 25: Line 24:
  disease.csv
  disease.csv
     cpr, name of disease, date of discovery
     cpr, name of disease, date of discovery
-->


'''2)'''
'''2)'''

Revision as of 12:40, 17 August 2026

Previous: Databases Next: Coding against databases

Material for the lesson

Note: The powerpoint has been updated with transactions, but not the video.
Video: Creating databases, data types
Video: Using SQL language to create tables, manipulate data and retrieve data.
Video: Functions in SQL (aggregate, string, math, etc), loading files into tables, vice versa
Powerpoint: MySQL
Video: Exercises

Exercises

2) Use the SQL language to answer some questions about the data or manipulate it in some ways.

  1. Who do not have a father ?
  2. How many do not have a mother?
  3. How many cases of cancer - any type? You get to decide if a tumor also means cancer.
  4. How many persons had cancer – any type?
  5. Who are or have been married to someone named ’Finn’ (male name)?
  6. Create 2 imaginary persons. Marry them to each other. Make them have a kid. Give the kid a broken nose. Insert all this info in the database.
  7. Delete everyone with the last name ’Rapacki’. Make sure that database is consistent afterwards, like there is no marriages to non-existing persons or references to non-existing parents.

The solutions to be handed in are the SQL statements, that solves the problems.