Home > Database > Mysql Tutorial > MySQL创建计算字段――MySQL系列(五)_MySQL

MySQL创建计算字段――MySQL系列(五)_MySQL

WBOY
Release: 2016-06-01 13:17:44
Original
1182 people have browsed it

1、字段

字段与列含义差不多,数据库列一般叫列,字段一般是指计算字段

2、拼接字段

拼接——将值连接到一起构成单个值

Concat()函数

SELECT Concat(name,'(',country,')')AS title FROM companyOrder BY name;
Copy after login
这里的AS title,是取别名,title就是计算字段

3、执行算数计算

可以进行加减乘除的运算

Select prod_num*prod_price,prod_nameFROM products 
Copy after login

4、如何测试计算

SELECT 3*2,将返回6

SELECT NOW(),将返回现在时间

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template