Facebook
From Thundering Human, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 37
  1. create table dept (dept_id integer, dname varchar(20), INDEX dept_id_idx(dept_id));
  2. create table emp(emp_id INTEGER, dept_id INTEGER, INDEX dept_id_idx(dept_id), ename varchar(20), salary numeric(6,2), FOREIGN KEY (dept_id) REFERENCES dept(dept_id));
  3. insert into dept values (1, 'MARKETING');
  4. insert into dept values (2, 'RND');
  5. insert into emp values (1, 1, 'James', 1000);
  6. insert into emp values (2, 2, 'James', 2000);
  7. create table dept_arch like dept;