Ejercicios propuestos

EspaƱol

Classified by difficulty

T06.001- Create a table with name "xx" with 2 columns, col1 with integer type and col2 with char(3) type, and define col1 as primary key.

T06.002- Select the table

T06.003- Insert in the table the row (1,'AA')

T06.004- Insert in the table the row ('BB',2)

T06.005- Insert in the table the row (2,'BB')

T06.006- Select the table XX

T06.007- Close the session and identify again ("close and sign in again" or "disconnect" and "connect"). Next select again XX. Actually, if you have this clear it is not necessary for you to do it. We pretend to check the persistency of the created table and the data it contains: closing the session do not delete the stored data. Only drop table can eliminate the table from the catalog.

T06.008- Delete the table XX

T06.009- Create a table YY with 3 columns
col1(integer),
col2(char(2)) and
col3(varchar(10)),
and primary key (col1, col2)

T06.010- Insert the following data and query the table in order to see the stored data
(1,'AA','first')
(2,'AA','second')
(2,'BB','third')
(1,'AA','fourth')
(NULL,NULL,'fifth')
(NULL,'CC','sixth')
(3,NULL,'seventh')
(0,'','eighth') --0, empty string, 'eighth'
(3,'AA',NULL)

T06.011- Execute the following:
create table T1(a int,b int,c int,
primary key(a));

create table T2(a int,d int,e int,
primary key(d),foreign key(a) references T1(a));
and check, looking for the reason it fails, the result of the following statements:
a)insert in T1(1,10,100)
b)insert in T1(NULL,20,NULL)
c)insert in T1(2,20,NULL)
d)insert in T1(3,NULL,300)
e)insert in T2(2,NULL,NULL)
f) Insert in T2(2,20,NULL)
g) Insert in T1(1,20,200)
h) Insert in T2(4,10,100)
i) Insert in T2(2,30,230)

T06.012- Continue the previous
j) update T1(1,10,10) to (2,10,100)
k) update T1(1,1,100) to (5,10,100)
l) update T2(2,2,NULL) to (2,20,220)
m) update T2(2,2,220) to (5,20,220)
n) update T2(5,0,220) to (2,10,100)
o) update T1(2,2,200) to (6,60,600)
p)update T1(3,NULL,300) to (7,70,700)
q) update T2(2,10,00) to (7,10,100)
r) update T2(2,3,230) to (7,30,230)
s) update T1(2,0,NULL) to (6,60,600)

T06.013- Continue the previous
t) delete T2(7,30,230)
u) delete T1(7,70,700)
v) delete T1(5,10,100)
w) delete T2(7,10,100)
x) delete T1(7,70,700)
y) delete T1(6,60,600)