您的位置:首页 > 数据库 > MySQL

MySQL 数据修改

2015-11-22 14:11 561 查看

插入

-- 数据插入
INSERT INTO insert_table (`datetime`, `uid`, `content`, `type`) VALUES('0', 'userid_0', 'content_0', 0), ('1', 'userid_1', 'content_1', 1);

--复制相同数据
insert into users select *  from users where nick=‘bingone’;
Insert into Table2(field1,field2,...) select value1,value2,... from Table1
-- 创建新表插入
Select * into Table2 from Table1 where ...


修改

-- 多个表的UPDATE操作
UPDATE items,month SET items.price=month.price WHERE items.id=month.id;

-- 数据修改
update users set nick = 'bingone', user_id = '890000000020158216',api_key = 'a4b3f38430ef7be6704b03181e76e7cb' limit 1;
更新相同数据的第一条

数据追加
update users set field=concat(field, '072110003') where field='072110001';
update users set user_tag = user_tag | 16 where nick = ‘bingone’;


删除

DELETE FROM table_name [WHERE Clause]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: