mysql select语句中使用函数
程序员文章站
2022-04-30 17:07:17
...
实例如下:
创建数据表:
mysql> CREATE TABLE Employee(
-> id int,
-> first_name VARCHAR(15),
-> last_name VARCHAR(15)
-> );
Query OK, 0 rows affected (0.03 sec)
向表中插入数据:
mysql> insert into Employee(id,first_name, last_name)values (1,'Jason','Martin');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(2,'Alison','Mathews');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(3,'James','Smith');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(4,'Celia','Rice');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(5,'Robert','Black');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(6,'Linda', 'Green');
Query OK, 1 row affected (0.01 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(7,'David','Larry');
Query OK, 1 row affected (0.02 sec)
mysql>
mysql> insert into Employee(id,first_name, last_name)values(8,'James','Cat');
Query OK, 1 row affected (0.00 sec)
select语句中使用函数
mysql> SELECT concat(First_Name, " ",Last_Name) AS Name FROM Employee;
+----------------+
| Name |
+----------------+
| Jason Martin |
| Alison Mathews |
| James Smith |
| Celia Rice |
| Robert Black |
| Linda Green |
| David Larry |
| James Cat |
+----------------+
8 rows in set (0.00 sec)
推荐阅读
-
Oracle中 关于数据库存储过程和存储函数的使用
-
Oracle中SQL语句连接字符串的符号使用介绍
-
PHP下使用mysqli的函数连接mysql出现warning: mysqli::real_connect(): (hy000/1040): ...
-
python matplotlib中的subplot函数使用详解
-
JavaScript中反正弦函数Math.asin()的使用简介
-
python中函数默认值使用注意点详解
-
tensorflow中tf.slice和tf.gather切片函数的使用
-
C#使用linq语句查询数组中以特定字符开头元素的方法
-
python中的reduce内建函数使用方法指南
-
c#中虚函数的相关使用方法