Table creation in Databricks with alias column name

Viewed 51

HI I recently started exploring databricks,I got following issue

I am creating delta table but I want to give alias name to the column how can i give this. I tried with this approach but its not working

create or replace table gen1 (ID int, name string as tata)

I got following error

mismatched input 'as' expecting {')', ',', 'CONSTRAINT'}(line 1, pos 40)

== SQL ==

create  table gen1 (ID int, name string as EmpName )
1 Answers

There is no such thing as alias for a column name - aliases are used primarily when you doing select, etc. In your case, just give the column correct name directly: create table gen1 (ID int, EmpName string)

Related