Answers for "sql create table with references not primary key"

SQL
0

sql create table with references not primary key

CREATE TABLE Users(
  address varchar(100),
  phone_number varchar(20),
  userid serial,
  constraint pk primary key (address, phone_number ),
  constraint userid_unq unique (userid)
);

create table Stores(
  storeid int primary key,
  ownerID integer,
  constraint b_fk foreign key (ownerID)
    references Users(userid)
);
Posted by: Guest on October-19-2021

Code answers related to "sql create table with references not primary key"

Code answers related to "SQL"

Browse Popular Code Answers by Language