You are on page 1of 3

Task for BD05

Unit task details


Exercises
Before starting the exercises, you must create the necessary tables. To do this, use the
file dbOLYMPICS.sql and load and execute it to have the full schema to do the
exercises.

Exercise 1
 Insert a new record in the CITY table using the graphical tool offered by Mysql
Workbench. The data must be the following:
id: 7
name: Inca

 Insert a new record in the SCHOOL table using the graphical tool offered by Mysql
Workbench. The data must be the following:
id: 9
name: Pau Casesnoves
manager: Antoni Garau
city_id: 7

You must provide screenshots of the data insertion process and the moment before
applying the changes. Think about describing the captures.

Exercise 2
Insert more records into the STUDENT table using SQL statements. In the delivery of the
task you must copy the sentences that you have used. The data must be the following:

school_id id name birthdate gender


9 1 Macià 2001-10-25 M
9 2 Nadal M
9 3 Júlia 2001-12-23 F
1 14 Montse

The data that does not appear should not be used in the statements.

Exercise 3

Modify some student names. Use the graphical tool to do this, submitting with the task
screenshots showing all the changes you have made. The names that you must change
are:
student table:
school_id id name
1 1 Fernando GG
1 2 Lidia RG
1 3 Mario GC
1 4 Lidia GG
1 5 Gabriel PG

Exercise 4
Modify the SCHOOL record Named "Drago", using SQL statements, and change its
name to "Dracaena draco" and the manager to "Francisca". Do it using a single
SQL statement and copy it for the delivery of the task.

Exercise 5
Capitalize the names of students who are female. Do it using a single SQL statement
and copy it for the delivery of the task.
https://www.w3schools.com/mysql/mysql_ref_functions.asp

Exercise 6
Set the first of January, 2000 as birthdate for those students with a null value in this field.
Do it using a single SQL statement and copy it for the delivery of the task.

Exercise 7
Remove from the STUDENT table, those students with a null value in gender field. Do it
using only one SQL statement and copy it for the delivery of the task.

Exercise 8
Eliminate those student who are not participants in any modality of the Olympics. Do it
using only one SQL statement and copy it for the delivery of the task.

Exercise 9
Students from school id 9 (Pau Casesnoves) will participate in the Olympics with the
modality 3 (Information Technology). Insert them into PARTICIPANT table. Do it
using only one SQL statement and copy it for the delivery of the task.
https://www.w3schools.com/mysql/mysql_insert_into_select.asp

Exercise 10
Change the name of students that contain the surname “Fernández” for the same
name joined to his dorsal (composed by school id and student id). For example,
"Castilla Fernandez, Luis" will change to " Castilla Fernandez, Luis - 603" because his
school id is 6 and his student id is 03. Do it using only one SQL statement and copy it for
the delivery of the task.
Scoring criteria. Total 10 points.
EXERCISE 1: 0,5 Point
EXERCISE 2: 1 Point
EXERCISE 3: 0,5 Point
EXERCISE 4: 0,5 Point
EXERCISE 5: 1 Point
EXERCISE 6: 1 Point
EXERCISE 7: 0,5 Point
EXERCISE 8: 2 Point
EXERCISE 9: 2 Points
EXERCISE 10: 1 Points

Resources needed to carry out the Task.


 It could be useful to have installed the mysql server and workbench application to
test the answer.
 Web Browser
 Personal Computer
 Internet Connection

Recommendations.
It is recommendable do the exercises in the order in which they are indicated because in
some cases, to solve the exercise it is necessary to have done a previous one.

If by mistake, or by testing, you have modified or deleted data that you will need later,
you can load the file with the initial commands to start from scratch.

Submission rules.
Once the task is done, you will create a single document, the document should have the
answer of the exercises inside. The delivery of the document will be done through the
platform and the file document must be PDF named as follows:

Surname1_surname2_name_SIGxx_Task

Make sure the name does not contain the letter ñ, accents, or any other special
characters. For example, the student Begoña Sánchez Mañas for the second unit of the
subject BD, should name this task as...

sanchez_manas_begona_BD05_Task

You might also like