Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5)
Constraint dept_id_fk Foreign Key(DeptId)
References Department(DeptId)
)
Error I am getting: Constraint specification are not
allowed here
Answer Posted / durgarao k
There are two ways in specifying constraints
Table level and Column level
In your question you specified Foreign key constraint as column level constraint.so, at that time you write as
Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5)
Constraint dept_id_fk
References Department(DeptId)
)
if you want to specify Foreign key constraint at table level
you just do as
Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5),
Constraint dept_id_fk Foreign Key(DeptId)
References Department(DeptId)
)
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is ASM (Automatic Storage Management) in Oracle?
What is rowid and rownum in oracle?
material view and view disadvantages?
How many types of tables are there in oracle?
Explain cascading triggers.
How to set a transaction to be read only in oracle?
What is bulk collect in oracle?
Explain an index?
What is system global area (sga) in oracle?
How can I see all tables in oracle?
What is the exact use of Collections?
src name sex a,male b,female c,male d,female Required output : male female a,b c,d tried pivot but was not successfull select * from src pivot (max(name) for sex in ('MALE','FEMALE'));
hey friends, What are the steps I can do to transfer the database from Microsoft Access 2003 to oracle10g (or SQL) Best regards
I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.
How to list all indexes in your schema?