基本的SQL语言
创建
创建数据库,创建表
create database test; create table user( id int not null primary key, name varchar(32) not null, password varchar(32) not null);
可以用desc查看创建的表的结构
desc user;
增
alter添加字段
alter table user add sex int;
insert into添加数据
insert into user (id,name,password) values (001,‘a‘,‘123‘), (002,‘b‘,‘qwe‘), (003,‘c‘,‘zxc‘);
删
delete删除数据
delete from user where id=003; #删除指定行 delete from user; #删除表
alter删除字段
alter table user drop sex;
改
alter修改字段
alter table usermodify password int;
update修改数据
update user set name=‘xiaoming‘,password=‘123456‘ where id=001;
相关推荐
gallon00 2020-10-16
Youda 2020-08-29
thunderstorm 2020-08-19
nan00zzu 2020-08-08
ItBJLan 2020-06-28
msmysql 2020-06-26
liuyang000 2020-06-26
jacklife 2020-06-25
goodriver 2020-06-17
Ida 2020-06-17
xuanlvhaoshao 2020-06-16
IBMRational 2020-06-14
liuyang000 2020-06-12
CharlesYooSky 2020-06-11
godfather 2020-06-03
bluet00 2020-06-01
chenjiazhu 2020-06-01
weikaixxxxxx 2020-05-12