SIKI学院:MySQL数据库从零到精通:十八:课时 22 : 21-利用SQL语句对数据进行插入,删除和修改操作
目录
一.目的
1.想:提高学习效率,所以将老师的内容记录下来
二.参考
1.SIKI学院
三.注意
1.课程资源下载
1.MySQL下载地址
- good:官网的,和老师保持一致。
四.操作:成功
1.命令
22,创建表
create table tablename(
col_name type not null auto_increment,
col_name type default,
primary key(col_name)
);
desc tablename;查看表结构
插入表
insert into tablename(col_name,col_name,col_name)
values(value1,value2,value3,value4,value5);
更新数据
update tablename
set col_name = value,
col_name = value
where condition;
删除数据
delete from tablename where condition;
1.表格中插入数据
insert into mytable(username,password) values ('xzy','123');
insert into mytable(username,password) values ('xzy01','456');
insert into mytable(username,password) values ('xzy02','789');
select *from mytable;
1.更新表
update mytable set username='123';
update mytable set username='456' where id=1;
update mytable set username='Smartxzy',password='xzy' where id=2;
1.删除表内容
delete from mytable;
delete from mytable where id=7;