I have written following create table structures-
1.
Create Table Dept ;
(DeptID n(3) Primary Key, ;
DeptName c(40) Not Null, ;
HOD c(40) Not Null)
and
2.
Create Table emp ;
(Eid n(3) Primary Key
EName C(40) Not Null, ;
Gender l(1) Null Check Gender = 'M' Or Gender = 'F', ;
Salary n(6) Null Default 0, ;
DOB d(8) Not Null, ;
DeptID n(3) References Dept DeptID)
The first worked well but the second did not work giving syntax error message.
The field DeptID in the first table is Primary key whereas that in second table is foreign key.
I was learning to use primary key, foreign key in the table.
The error comes when I include following -
- Salary n(6) Null Default 0, and
- DeptID n(3) References Dept DeptID)
1.
Create Table Dept ;
(DeptID n(3) Primary Key, ;
DeptName c(40) Not Null, ;
HOD c(40) Not Null)
and
2.
Create Table emp ;
(Eid n(3) Primary Key
EName C(40) Not Null, ;
Gender l(1) Null Check Gender = 'M' Or Gender = 'F', ;
Salary n(6) Null Default 0, ;
DOB d(8) Not Null, ;
DeptID n(3) References Dept DeptID)
The first worked well but the second did not work giving syntax error message.
The field DeptID in the first table is Primary key whereas that in second table is foreign key.
I was learning to use primary key, foreign key in the table.
The error comes when I include following -
- Salary n(6) Null Default 0, and
- DeptID n(3) References Dept DeptID)