4

How can I rename a table in monetdb? The typical SQL statement ALTER TABLE name RENAME TO new_name is not supported.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
pic
  • 41
  • 2

2 Answers2

2

Also consider creating a SQL view with the new name, e.g. CREATE VIEW newname AS SELECT * FROM oldname;

This has the advantage of no data being copied around at all.

Hannes Mühleisen
  • 2,542
  • 11
  • 13
  • hi hannes - is there a similar approach for renaming columns? from what I found on the monetdb mailing lists it seems like the `rename column` syntax is not supported [1](https://www.monetdb.org/bugzilla/show_bug.cgi?id=2478)/[2](https://www.monetdb.org/pipermail/users-list/2009-February/002551.html). namely - got a column named `Key` which somehow got mangled throuh `monet.read.csv()` into `ï..Key`. (p.s. `monetdblite`) – davidski Jan 11 '17 at 14:35
2
ALTER TABLE [ IF EXISTS ] [ schema_name . ] table_name RENAME TO  new_table_name

It's supported since 2019 MonetDB website

Lin_n
  • 189
  • 1
  • 4