Home >Database >Mysql Tutorial >mySQL uses code to add table content and delete data methods

mySQL uses code to add table content and delete data methods

一个新手
一个新手Original
2017-09-30 10:15:491690browse

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(值)

2. Delete data

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

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 条件

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!

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