How do I create a table MANAGER (EMP-NO, MANAGER) where
MANAGER is a foreign key which references to EMP-NO in the
same table? Give the exact DDL.

Answers were Sorted based on User's Feedback



How do I create a table MANAGER (EMP-NO, MANAGER) where MANAGER is a foreign key which references ..

Answer / shankar v

Above one is true but a small correction is needed as below:

CREATE TABLE TB_MANAGER
(EMP-N0 CHAR(6) PRIMARY KEY NOT NULL,
MANAGER CHAR(6) NOT NULL)
IN TABLESPACE;

ALTER TABLE MANAGER
FOREIGN KEY (MANAGER) REFERENCES TB_MANAGER(EMP_NO)
ON DELETE CASCADE;

Is This Answer Correct ?    3 Yes 0 No

How do I create a table MANAGER (EMP-NO, MANAGER) where MANAGER is a foreign key which references ..

Answer / s

CREATE TABLE QUALIFIER.TABLE
(EMP-N0 CHAR(6) NOT NULL,
MANAGER CHAR(6) NOT NULL)
IN TABLESPACE;

ALTER TABLE QUALIFIER.TABLE
FOREIGN KEY FKM (MANAGER) REFERENCES QUALIFIER.TABLE
ON DELETE CASCADE;

Is This Answer Correct ?    1 Yes 1 No

How do I create a table MANAGER (EMP-NO, MANAGER) where MANAGER is a foreign key which references ..

Answer / sahil garg

CREATE TABLE TB_MANAGER
(EMPNO CHAR(6) PRIMARY KEY ,
MANAGER CHAR(6) );


ALTER TABLE TB_MANAGER
ADD CONSTRAINT TB_FK FOREIGN KEY (MANAGER) REFERENCES
TB_MANAGER(EMPNO);

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More DB2 Interview Questions

what is REORG? what is the use?

4 Answers  


What is meant by repeatable read?

4 Answers  


What is meant by index cardinality?

2 Answers  


What is scrollable cursor in db2?

0 Answers  


What is precompiler in db2?

0 Answers  






What is a DB2 plan?

8 Answers  


What is dbrm? What it contains?

0 Answers  


how to fetch multiple records without using cursor

14 Answers   HCL,


What is the picture clause of the null indicator variable?

6 Answers  


Describe major components of db2?

0 Answers  


I have two tables A and B. Both tables are connected with SSN number as foreign key. I want to retrieve a column data from B table. How will you write a query?

3 Answers   CTS,


What is a subselect? Is it different from a nested select?

1 Answers  


Categories