[英]How can I simulate a print statement in MySQL?
我有一些程序,我希望在評估條件后得到某種確認。
例如,pusdocode 會是這樣的,
if ( select count(*) from assgn to where eid = 1 ) > 5
print " the total number of projects employee working is more than 5 "
else
insert the value into the assgnto table
我應該如何在 MySQL 中做到這一點?
如果您不想將文本兩次作為列標題和值,請使用以下 stmt!
SELECT 'some text' as '';Example:
mysql>SELECT 'some text' as ''; +-----------+ | | +-----------+ | some text | +-----------+ 1 row in set (0.00 sec)
您可以使用SELECT
命令打印一些文本,如下所示:
SELECT 'some text'
結果:
+-----------+
| some text |
+-----------+
| some text |
+-----------+
1 row in set (0.02 sec)
要在 MySQL 中獲取輸出,您可以使用 if 語句 SYNTAX:
if(condition,if_true,if_false)
if_true 和 if_false 可用於驗證和顯示輸出,因為 MySQL 中沒有打印語句
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.