Exercises by difficulty

EspaƱol

No order


Difficulty B


T07.001- Create the following tables:
TA (a int, b int) PK(a)
TB (c int, d int) PK(c) FK(d) >> TA (delete: propagate, update:propagate)
TC (e int, f int) PK(e) FK(f) >> TB (delete:propagate, update: propagate)

T07.002- Insert the following data
TA(1,10)
TA(2,20)
TA(3,30)
TB(100,1)
TB(200,1)
TB(300,2)
TB(400,NULL)
TC(1000,100)
TC(2000,100)
TC(3000,NULL)

T07.003- Delete TA(2,20) and check the changes that have been produced in the 3 tables

T07.004- Update TA(1,10) to TA(15,10) and check the changes in the 3 tables.

T07.005- Delete TC(2000,100) and check the changes in the 3 tables.

T07.006- Delete TA(3,30) and check the changes in the 3 tables.

T07.007- Delete TB(100,15) and check the changes in the 3 tables.

T07.008- Delete TC(3000,NULL) and check the changes in the 3 tables.

T07.009- Delete TB(400,NULL) and check the changes in the 3 tables.

T07.010- Delete TA(15,10) and check the changes in the three tables: Are the 3 tables empty?

T07.011- Create the tables again:
TA (a int, b int) PK(a)
TB (c int, d int) PK(c) FK(d) >> TA
(delete set null, update set null)
TC (e int, f int) PK(e) FK(f) >> TB
(delete set null, update set null)

T07.012- Fill the tables again:
TA(1,10)
TA(2,20)
TA(3,30)
TB(100,1)
TB(200,1)
TB(300,2)
TB(400,NULL)
TC(1000,100)
TC(2000,100)
TC(3000,NULL)

T07.013- Execute the following statements:
Delete TA(2,20)
Update TA(1,10) to TA(15,10)
Update TB(100,NULL) to TB(150,NULL)
Is there any value in the foreign key distinct to NULL?

T07.014- Create the tables again:
TA (a int, b int) PK(a)
TB (c int, d int) PK(c) FK(d) >> TA (delete propagate)
TC (e int, f int) PK(e) FK(f) >> TB (update set null)
TA(1,10)
TA(2,20)
TA(3,30)
TB(100,1)
TB(200,1)
TB(300,2)
TB(400,NULL)
TC(1000,100)
TC(2000,100)
TC(3000,NULL)

T07.015- Delete TA(1,10): What happens?

T07.016- Delete TA(2,20): What happens?

T07.017- Update TB(100,1) to TB(170,1): what happens?

T07.018- Try to delete TA(1,10) again: Why now is it possible?