不知道我的列名是怎么回事。
mysql> SELECT fullname FROM country WHERE year-independence > 1945;
ERROR 1054 (42S22): Unknown column 'year' in 'where clause'
以下是表格限制5:
+----------------------------------------------+
| code | fullname | continent | region | area | year-independence | population | avg-lifespan | avg-GNP | form-government |
+------+----------------------+---------------+---------------------------+--------+-------------------+------------+--------------+-----------+----------------------------------------------+
| ABW | Aruba | North America | Caribbean | 193 | 0 | 103000 | 78.40 | 828.00 | Nonmetropolitan Territory of The Netherlands |
| AFG | Afghanistan | Asia | Southern and Central Asia | 652090 | 1919 | 22720000 | 45.90 | 5976.00 | Islamic Emirate |
| AGO | Angola | Africa | Central Africa | 124670 | 1975 | 12878000 | 38.30 | 6648.00 | Republic |
| AIA | Anguilla | North America | Caribbean | 96 | 0 | 8000 | 76.10 | 63.20 | Dependent Territory of the UK |
| ALB | Albania | Europe | Southern Europe | 28748 | 1912 | 3401200 | 71.60 | 3205.00 | Republic
2条答案
按热度按时间pkmbmrz71#
尝试:
vxbzzdmp2#
mysql中的某些对象,包括数据库、表、索引、列、别名、视图、存储过程、分区、表空间、资源组和其他对象名,称为标识符。[…]如果标识符包含特殊字符或是保留字,则每次引用时都必须引用它。[…]
根据https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
标识符引号字符是反勾号(`):
对你来说
你可能已经注意到我用反记号包围了所有的标识符,因为这样做是一个好习惯。