Exercice : La somme finale
Que renvoie la dernière instruction SQL de la séquence ci-dessous ?
1
CREATE TABLE R1 (a INTEGER, b INTEGER);
2
CREATE TABLE R2 (b INTEGER);
3
INSERT INTO R1 VALUES (1,1);
4
INSERT INTO R1 VALUES (2,1);
5
INSERT INTO R2 VALUES (1);
6
INSERT INTO R2 VALUES (2);
7
SELECT sum(R1.a) FROM R1, R2 WHERE R1.b=R2.b;
CREATE TABLE R1 (a INTEGER, b INTEGER); CREATE TABLE R2 (b INTEGER); INSERT INTO R1 VALUES (1,1); INSERT INTO R1 VALUES (2,1); INSERT INTO R2 VALUES (1); INSERT INTO R2 VALUES (2); SELECT sum(R1.a) FROM R1, R2 WHERE R1.b=R2.b;