A sequence was created with the DDL statement shown below:
CREATE SEQUENCE my_sequence CACHE 10 ORDER
The following statements are successfully executed in sequence through separate database connections:
CONNECTION1 - VALUES NEXT VALUE FOR my_sequence INTO :con1hvar CONNECTION2 - VALUES NEXT VALUE FOR my_sequence INTO :con2hvar CONNECTION1 - VALUES NEXT VALUE FOR my_sequence INTO :con1hvar
What is the current value of the :con1hvar host variable?
A sequence was created with the DDL statement shown below:
CREATE SEQUENCE my_seq START WITH 5 INCREMENT BY 5 CACHE 5
User1 successfully executes the following statements in Connection1:
VALUES NEXT VALUE FOR my_seq INTO :con1hvar
VALUES NEXT VALUE FOR my_seq INTO :con1hvar
User2 successfully executes the following statement in Connection2:
VALUES NEXT VALUE FOR my_seq INTO :con2hvar
After User1 & User2 are finished, User3 executes the following statement in Connection3:
SELECT NEXT VALUE FOR my_seq FROM sysibm.sysdummy1
Which value will be returned by the query?
The following statements:
CREATE TABLE t1 (col1 INT NOT NULL, PRIMARY KEY (col1)); CREATE TABLE t2 (col1 INT NOT NULL, col2 CHAR(1) NOT NULL, PRIMARY KEY (col1, col2),
FOREIGN KEY (col1) REFERENCES t1 (col1)
ON DELETE CASCADE ON UPDATE RESTRICT);
CREATE TABLE t3 (col1 INT NOT NULL, col2 INT NOT NULL, PRIMARY KEY (col1, col2), FOREIGN KEY (col1) REFERENCES t1 (col1)
ON DELETE NO ACTION ON UPDATE RESTRICT);
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1, 'a'), (1, 'b'), (2,'c');
INSERT INTO t3 VALUES (1, 100), (2, 200), (2,300);
How many rows will be deleted by the following DELETE statement? DELETE FROM t1 WHERE col1 = 1;
Given the following statements:
CREATE TABLE tab1 (col1 INT);
CREATE TABLE tab2 (col1 INT);
CREATE TRIGGER trig1 AFTER UPDATE ON tab1
REFERENCING NEW AS new1
FOR EACH ROW MODE DB2SQL
INSERT INTO tab2 VALUES(new1.col1);
INSERT INTO tab1 VALUES(2),(3);
What is the result of the following query?
SELECT count(*) FROM tab2;
Given the following function:
CREATE FUNCTION emplist ()
RETURNS TABLE ( id CHAR(6)
, firstname VARCHAR(12)
, lastname VARCHAR(15) )
LANGUAGE SQL
BEGIN ATOMIC
RETURN
SELECT EMPNO, FIRSTNME, LASTNAME
FROM EMPLOYEE
WHERE WORKDEPT IN ('A00', 'B00');
END
How can this function be used in an SQL statement?