Write a postgre SQL statement to add a primary key for a combination of columns location_id and country_id.
Here is the structure of the table locations.
postgres=# \d locations
Column | Type | Modifiers
----------------+-----------------------+-----------
location_id | numeric(4,0) |
street_address | character varying(40) |
postal_code | character varying(12) |
city | character varying(30) |
state_province | character varying(25) |
country_id | character varying(2) |
Output:
Now see the structure of the table locations after alteration.
postgres=# \d locations Column | Type | Modifiers ----------------+-----------------------+----------- location_id | numeric(4,0) | not null street_address | character varying(40) | postal_code | character varying(12) | city | character varying(30) | state_province | character varying(25) | country_id | character varying(2) | not null Indexes: "locations_pkey" PRIMARY KEY, btree (location_id, country_id)need an explanation for this answer? contact us directly to get an explanation for this answer