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

Explain an outer join?

1 Answers  


What is tablespace?

3 Answers  


Bind concepts in DB2 cobol

10 Answers   IBM, TCS, TRD, Virtusa,


What happens to the PLAN if index used by it is dropped?

1 Answers  


How do run the JCL which has 25 steps by skipping the following steps 5, 10,15 and 25 without using COND statement

5 Answers   Syntel,






What is the physical storage length of time data type?

0 Answers  


List out the three types of page locks that can be held.

0 Answers  


How do you concatenate the firstname and lastname from emp table to give a complete name?

0 Answers  


what is the role of the cursor in db2?

0 Answers  


When Can you be sure that a query will return only one row?

4 Answers   IBM,


Suppose I have a program which uses a dynamic SQL and it has been performing well till now. Off late, I find that the performance has deteriorated. What happened?

1 Answers  


What if we try to insert the base table through updatable view , but failed to give a column value which is defined as NOT NULL.

1 Answers   Cap Gemini,


Categories