在执行SQL脚本时如何回显打印语句?
要在执行SQL脚本时执行回显打印语句,请使用以下语法。
语法如下-
SELECT ‘anyStringValue as’ ‘;
查询如下-
mysql> select 'This is a SQL Script' AS' ';
以下是输出-
+----------------------+ | | +----------------------+ | This is a SQL Script | +----------------------+ 1 row in set, 1 warning (0.00 sec)
您可以借助concat()
方法将动态数据添加到状态,例如插入,更新和删除。查询如下-
mysql> select concat ("Inserted ", row_count(), " rows successfully") AS '';
以下是输出-
+-------------------------------+ | | +-------------------------------+ | Inserted -1 rows successfully | +-------------------------------+ 1 row in set (0.00 sec)