Home > Database > Mysql Tutorial > body text

mySQL uses code to add table content and delete data methods

一个新手
Release: 2017-09-30 10:15:49
Original
1677 people have browsed it

Operation on table content through code:

1. Add data

insert into Info values('p009','张三',1,'n001','2016-8-30 12:9:8') ;
    给特定的列添加数据insert into Info (code,name) values('p010','李四');
    自增长列的处理insert into family values('','p001','数据','T001','数据',1);
    insert into 表名 values(值)
Copy after login

2. Delete data

删除所有数据delete from family
删除特定的数据delete from Info where code='p001'
delete from 表名 where 条件
Copy after login

3. Modify data

修改所有数据update Info set name='徐业鹏' 
修改特定数据update Info set name='吕永乐' where code='p002' 
修改多列update Info set name='吕永乐',sex=1 where code='p003'
update 表名 set 要修改的内容 where 条件
Copy after login

The above is the detailed content of mySQL uses code to add table content and delete data methods. For more information, please follow other related articles on the PHP Chinese website!

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!