SQL Alter table command not working for me
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2021 11:32 AM
I am a novice with databricks. I am performing some independent learning. I am trying to add a column to an existing table. Here is my syntax:
%sql
ALTER TABLE car_parts ADD COLUMNS (engine_present boolean)
which returns the error:
SyntaxError: invalid syntax File "<command-3097619422049343>", line 4 ALTER TABLE car_parts ADD COLUMNS (engine_present boolean) In general I am having issues executing raw sql commands from these execution windows (cells) in my databricks community edition tool. I have also tried: sqlContext.sql("ALTER TABLE car_parts ADD engine_present boolean") , which returns the error: ParseException: no viable alternative at input 'ALTER TABLE car_parts ADD engine_present' (line 1, pos 31) I am certain the table is present as:sqlContext.sql("SELECT * FROM car_parts")
works fine. I would grateful for any insights. Thank you.
Labels:
- Labels:
-
Alter table
-
Pyspark