SQL> create table emp (empno numeric(4) not null,
2 ename varchar(10),
3 job varchar(9),
4 mgr numeric(4),
5 hiredate date,
6 sal numeric(7,2),
7 comm numeric(7,2),
8 deptno numeric(2),
9 constraint pk_emp primary key(empno),
10 constraint fk_emp_deptno foreign key (deptno) references dept(deptno));
Table created.
SQL>
SQL> create table salgrade (grade numeric(1),
2 losal numeric(4),
3 hisal numeric(4),
4 constraint pk_salgrade primary key(grade));
Table created.
SQL> create table dept (deptno numeric(2),
2 dname varchar(14),
3 loc varchar(13));
Table created.
SQL> alter table dept
2 add primary key (deptno);
Table altered.
2 ename varchar(10),
3 job varchar(9),
4 mgr numeric(4),
5 hiredate date,
6 sal numeric(7,2),
7 comm numeric(7,2),
8 deptno numeric(2),
9 constraint pk_emp primary key(empno),
10 constraint fk_emp_deptno foreign key (deptno) references dept(deptno));
Table created.
SQL>
SQL> create table salgrade (grade numeric(1),
2 losal numeric(4),
3 hisal numeric(4),
4 constraint pk_salgrade primary key(grade));
Table created.
SQL> create table dept (deptno numeric(2),
2 dname varchar(14),
3 loc varchar(13));
Table created.
SQL> alter table dept
2 add primary key (deptno);
Table altered.