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

My cobol program(not having any sql statements) is calling another cobol program ( having sql statements), what is needed for compilation and run in jcls .

3 Answers   Cap Gemini, RBS,


How can you display the current date & current time ?

7 Answers   Cap Gemini,


How to check table size in db2 sap?

0 Answers  


What db2 400?

0 Answers  


what are the bind parameters?

5 Answers   IBM,






How to resolve -917 sql code in DB2?

3 Answers   Cap Gemini,


Explain about rct in db2?

0 Answers  


How to restart a DB2 program?

0 Answers   Cognizant,


what is db2 restart?

0 Answers  


How to create backup table in db2?

0 Answers  


What is db2 isolation?

2 Answers  


In BIND, isolation level parameter specifies the duration of page lock and ACQUIRE, RELEASE also do almost the same thing. What is the exact difference between the two? Do they work in conjunction while executing SQL queries and obtaining locks?

8 Answers   Syntel,


Categories