mysql基础---DOS下创建表(增删改查)

1.创建表:

create table 表名 (

列1 类型1 约束1,

列2 类型2 约束2,

列3 类型3

);

例如:

create table student(

id int primary key,

name varchar(20) not null,

sex char(1)

);

2.插入数据 insert into

a.全量插入

insert into 表名 values (列1值,列2值,列3值);

eg:insert into student values (1,'张三','男');

b.部分插入(插入指定列)

insert into 表名 (列1,列2) values (列1值,列2值);

eg:insert into student  (id,name) values (1,'张三');

3.修改数据 update

update 表名 set  列=值 where 条件;

eg:update student name='李四' where id=1;

4.查询数据 select

select 列/* from 表名 where 条件;      

eg:select * from student;

5.删除数据 delete

delete from 表名 where 条件;

eg:delete from student where id=1;

猜你喜欢

转载自www.cnblogs.com/sujw/p/12711907.html