Login
登录 注册 安全退出
当前位置: 首页 > 文档资讯 > 技术教程 > 我们如何使用 MySQL 自计算的任何表达式、函数等的输出来在行中插入值?

我们如何使用 MySQL 自计算的任何表达式、函数等的输出来在行中插入值?

时间:2023-09-10浏览: [ ]

在一行中插入值时,我们可以使用任何表达式、函数等自计算输出的值。下面是一个示例来演示它 -

mysql> Insert into employee(id, emp_name)Select 1+1, Concat_ws(' ','Gaurav', 'Kumar');
Query OK, 1 row affected (0.04 sec)
Records: 1 Duplicates: 0 Warnings: 0

mysql> Select * from employee;
+------+--------------+
| id   | emp_name     |
+------+--------------+
| 2    | Gaurav Kumar |
+------+--------------+
1 row in set (0.00 sec)
复制本文链接文章为作者独立观点不代表优设网立场,未经允许不得转载。