简体   繁体   English

雪花创建表语法

[英]Snowflake create table syntax

I'm developing a program to parse sql queries I'm getting.我正在开发一个程序来解析我得到的 sql 查询。 I've encountered a syntax I'm not familiar with:我遇到了一个我不熟悉的语法:

create table if not exists identifier(table1) ("ID" INTEGER)

I'm not familiar with the identifier usage and couldn't find any relevant documentation.我不熟悉标识符的用法,也找不到任何相关文档。 Any ideas?有任何想法吗?

I can't tell whether you are trying to use an identifier() function to use a variable or not, but if you are, I think you're looking for something like this:我不知道您是否正在尝试使用 identifier() 函数来使用变量,但如果是,我认为您正在寻找这样的东西:

set table1 = 'my_table';

create table if not exists identifier($table1)(ID integer);

As an additional note, I wouldn't use double-quotes around your column names unless you are trying to escape a special character.作为附加说明,除非您试图转义特殊字符,否则我不会在您的列名周围使用双引号。

If you are not trying to use a variable in your table name, then just get rid of the identifier() function altogether.如果您不想在表名中使用变量,那么只需完全摆脱 identifier() 函数即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM