我们如何将一个整数值添加到mysql数据库 [英] how can we add a integer value to the mysql database

查看:99
本文介绍了我们如何将一个整数值添加到mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我想将一个假设为15的整数添加到mysql数据库字段[integer],

hello

i wanted to add a integer value suppose 15 to the mysql database field[integer],
what is the query for that

推荐答案

使用的是INSERT语句(将插入整行)或UPDATE语句(将仅更改值)
Use either an INSERT statement (which will insert a whole row), or an UPDATE statement (which will change just the value)
INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...) (nextvalue1, nextvalue2, ...)


UPDATE table_name SET field=newvalue, field... WHERE ...

在第二种情况下,请确保设置WHERE子句,否则表中的所有行都会被更改!

In the second case, be sure to set the WHERE clause, or all rows in the table will be changed!


不能简单地这样:
Should not be simply this:
INSERT INTO myTable (someNumericField) VALUES (15)


参考:我的SQL:INSERT语法 [


Refer: My SQL: INSERT Syntax[^]


UPDATE:

UPDATE myTable SET(someNumericField = someNumericField + 15)


这篇关于我们如何将一个整数值添加到mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆