Answers for "create table postgresql foreign key"

SQL
2

postgres add foreign key to existing table

ALTER TABLE tblA ADD COLUMN colA VARCHAR(10); /* 1st add column */
ALTER TABLE tblA ADD CONSTRAINT colA /* Make colA on tblA a foreign key */
FOREIGN KEY (colA) REFERENCES tblB (colB); /* colB must be a pk on tblB*/
Posted by: Guest on August-27-2021
3

create table postgresql foreign key

CREATE TABLE so_items (
	so_id INTEGER,
  	...
	FOREIGN KEY (so_id) REFERENCES so_headers (id)
);
Posted by: Guest on April-24-2020
2

psql create table foreign keys

# id_user is the primary key of the table users:
create table lists(
id_list serial not null primary key,
id_user int references users(id_user),
is_temp int
);
Posted by: Guest on January-15-2021

Code answers related to "create table postgresql foreign key"

Code answers related to "SQL"

Browse Popular Code Answers by Language