Home > Database > Mysql Tutorial > body text

MySQL创建计算字段

WBOY
Release: 2016-06-07 16:19:31
Original
973 people have browsed it

1、字段 字段与列含义差不多,数据库列一般叫列,字段一般是指计算字段 2、拼接字段 拼接将值连接到一起构成单个值 Concat()函数 ? 1 2 3 SELECT Concat(name,'(',country,')') AS title FROM company Order BY name; 这里的AS title,是取别名,title就是计

   1、字段

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

  2、拼接字段

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

  Concat()函数

?

1

2

3

SELECT Concat(name,'(',country,')')

AS title FROM company

Order BY name;

  这里的AS title,是取别名,title就是计算字段

  3、执行算数计算

  可以进行加减乘除的运算

?

1

2

Select prod_num*prod_price,prod_name

FROM products 

  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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!