Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 表列名为';默认值';_Mysql_Sql_Database - Fatal编程技术网

Mysql 表列名为';默认值';

Mysql 表列名为';默认值';,mysql,sql,database,Mysql,Sql,Database,我很难查询列名为“default”的表, 它显示了一个错误,我无法重命名它,因为我使用的是旧系统,它可能会影响我们以前的系统 e、 g 试过这个 select * from table_name where 'default' = 1 但它不起作用 有解决方法吗?您应该使用反向提示: select * from table_name where `default` = 1 对于SQL Server(不确定是否使用其他数据库),您可以使用以下方法: select * from table_n

我很难查询列名为“default”的表, 它显示了一个错误,我无法重命名它,因为我使用的是旧系统,它可能会影响我们以前的系统

e、 g

试过这个

select * from table_name where 'default' = 1
但它不起作用


有解决方法吗?

您应该使用反向提示:

select * from table_name where `default` = 1
对于SQL Server(不确定是否使用其他数据库),您可以使用以下方法:

select * 
from table_name 
where [default] = 1
or [index] = 'another example'
您可以为数据库内置关键字的任何列设置[]


希望这对你有帮助。

ANSI SQL和大多数dbms产品都有“默认”,SQL Server也有[default],MySQL有
default
。谢谢,最好的方法。
select * 
from table_name 
where [default] = 1
or [index] = 'another example'