Q:

Write a postgre SQL statement to add a column region_id to the table locations

0

 Write a  postgre SQL statement to add a column region_id to the table locations.

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)  |

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

ALTER TABLE locations
ADD region_id  INT;

Output:

See the structure of the table after alteration.

postgres=# \d locations

     Column     |         Type          | M
----------------+-----------------------+--
 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)  |
 region_id      | integer               |

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now