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
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 |
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 |
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 |
what is the sqlcode -501
How is the SUBSTR keyword used in sql?
What is reorg?
List some fields from sqlca?
What is bind in db2?
Why do we need to create an alias if we can directly use the table name? What are the benefits of referring a table name by its alias? Also, when should we go for alias and when for synonyms?
List out the three types of page locks that can be held.
What is Call attach facility? How does it work?
What is null in db2?
How we create a tables in db2,what is the process/syntax to create a table with example plz?
If a table has a column "dept" (declared to have nulls) and there are 10 rows in the table of which 3 have a null value in the dept column, what will select count(*) and select count(distinct dept) return?
DB2: A calls B once sucessfull and second time when it calls says curson is open why is it so?