File: 03_fk.sql

package info (click to toggle)
liborlite-perl 1.44-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 348 kB
  • ctags: 182
  • sloc: perl: 2,726; sql: 36; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 348 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
create table table_one (
	col1 integer not null primary key,
	col2 string
);

create table table_two (
	col1 integer not null primary key,
	col2 integer not null CONSTRAINT fk_table_two_col2 REFERENCES table_one(col1) ON DELETE CASCADE
);

insert into table_one ( col1, col2 ) values ( 1, 2 );

insert into table_two ( col1, col2 ) values ( 1, 1 )