剛剛學SQL,做練習時報錯。望指教。
SQL> select * from regions;
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
SQL> SQL> select region_id * 100/5 + 20 / 10 - 5 “Meteor Shower Probability %”
2 from regions;
select region_id * 100/5 + 20 / 10 - 5 AS “Meteor Shower Probability %”
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
SQL>
uj5u.com熱心網友回復:
別名的時候,不用ASuj5u.com熱心網友回復:
不加AS也不行。AS加不加報錯一樣
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
uj5u.com熱心網友回復:
你的雙引號,格式是不是中文格式的uj5u.com熱心網友回復:
換行導致的問題,第2行前加個空格試試uj5u.com熱心網友回復:
別名不需要加引號,而且只能是一個單詞(即中間無空格)uj5u.com熱心網友回復:
寫成 select region_id * 100/5 + 20 / 10 - 5 Meteor from regions 就是對的,至于別名究竟是什么,你再考慮uj5u.com熱心網友回復:
應該是雙引號的問題,雙引號是中文的。修改后結果:SQL> select region_id * 100/5 + 20 / 10 - 5 AS "Meteor Shower Probability %" from regions;
Meteor Shower Probability %
---------------------------
17
37
57
77
SQL> select region_id * 100/5 + 20 / 10 - 5 "Meteor Shower Probability %" from regions;
Meteor Shower Probability %
---------------------------
17
37
57
77
SQL>
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/92106.html
標籤:基礎和管理
上一篇:大資料批量匹配資料庫
