Tag: databases

Questions Related to databases

  1. Select * from T1 minus select * from T2

  2. Select * from T1 except select * from T2

  3. Select * from T1 union except select * from T2

  4. Select * from T1 not exists select * from T2


Correct Option: B

Given the following two tables: TAB1 C1 C2 1 Antarctica 2 Africa 3 Asia 4 Australia TAB2 CX CY 5 Europe 6 North America 7 South America Which of the following SQL statements will insert all rows found in table TAB2 into table TAB1?

  1. INSERT INTO tab1 SELECT cx, cy FROM tab2

  2. INSERT INTO tab1 VALUES (tab2.cx, tab2.cy)

  3. INSERT INTO tab1 VALUES (SELECT cx, cy FROM tab2)

  4. INSERT INTO tab1 (c1, c2) VALUES (SELECT cx, cy FROM tab2)


Correct Option: A

Given the following table and XML data stored in the CONTACTINFO column: CREATE TABLE clients( id INT PRIMARY KEY NOT NULL, name VARCHAR(50), status VARCHAR(10), contactinfo XML ) 25 EastCreek Toronto OntarioM8X-3T6 4165551358 9051112222 9051112222 by fax What is the result of the following XQuery expression? for $y in db2-fn:xmlcolumn('CLIENTS.CONTACTINFO')/Client//fax return $y

  1. 4165551358

  2. 9051112222

  3. No results because there is no child element

  4. No results because the XQuery expression is not a valid FLWOR expression


Correct Option: B

Given the following table and XML data stored in the EMPDETAILS column: CREATE TABLE employees (Emp-id INT PRIMARY KEY NOT NULL, Emp-name VARCHAR (20), Empdetails XML) The data in the EMPDETAILS are ProjectManager Chennai 987654 What is the result of the following XQuery Expression? For $y in db2-fn:xmlcolumn(EMPLOYEES. EMPDETAILS’)/Employee/designation return $y

  1. ProjectManager

  2. ProjectManager

  3. chennai

  4. 987654


Correct Option: A

In which situation is shredding XML data recommended?

  1. When the data is naturally tabular

  2. When the number of nodes are volatile

  3. When the data by nature has sparse attributes

  4. When the data is of low volume and requires a complex star-schema topology


Correct Option: A
  1. A unique index

  2. .A composite index

  3. A check constraint

  4. .A generated column


Correct Option: A