I am creating a table dummy2 using the values in another table dummy. This is my syntax:
CREATE TABLE dummy2 AS SELECT
t1.zid AS orig_id,
t2.zid AS dest_id,
ABS(RANDOM()*(45-2)-45) AS dist
FROM dummy t1, dummy t2;
The attribute zid in dummy is stored as DOUBLE PRECISION. However, in the new table I would like to change its data-type to say, INTEGER. How can I achieve this? My initial thoughts were this (very similar to the way we declare the data-type when creating a table using the schema:
CREATE TABLE dummy2 AS SELECT
t1.zid AS orig_id INTEGER,
t2.zid AS dest_id INTEGER,
ABS(RANDOM()*(45-2)-45) AS dist
FROM dummy t1, dummy t2;
But it fails to execute. Can anyone help me out with this? Appreciate the assistance!