gpt4 book ai didi

mysql建表查询问题?

转载 作者:太空宇宙 更新时间:2023-11-03 11:20:31 25 4
gpt4 key购买 nike

我想创建一个表,其名称类似于:

name_thisyear_thisweekofyear,例如 -> name_2009_40

我试过这个查询:

如果不存在则创建表 name_YEAR(NOW())_WEEKOFYEAR(NOW())(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, phone_no int, created datetime, deleted datetime)

它不起作用。请帮忙

错误信息:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOW())_WEEKOFYEAR(NOW())(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, userid int,' at line 1

最佳答案

你不能那样做......你必须指定表名,函数不能在那里执行

An identifier may be quoted or unquoted. If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it. The set of alphanumeric characters from the current character set, “_”, and “$” are not special.

关于mysql建表查询问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1298634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com