[英]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.