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

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

WBOY
WBOYOriginal
2016-06-01 13:17:441119browse

1、字段

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

2、拼接字段

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

Concat()函数

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

3、执行算数计算

可以进行加减乘除的运算

Select prod_num*prod_price,prod_nameFROM products 

4、如何测试计算

SELECT 3*2,将返回6

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

Statement:
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