MySQL基础语法-增删查改

1.创建数据库,表

create database exam;
use exam;
create table student(   #创建表
stuNumber char(20) primary key,
stuName char(20) not null,
stuPwd char(50) not null,
birthday date,
classId char(20),
)engine=InnoDB default charset=gbk;

2.表

show tables;#显示当前数据库中表
desc 表名;#看表结构
select * from 表名;#看表数据
insert into student (stuNumber,stuPwd,stuName) values(1,123,hh);
#student表为例,表中插入数据
update student set stuNumber=2 where stuName=123;#修改表中数据(stuNumber=1)
delete from student where stuNumber=2;#删除表中数据

你可能感兴趣的:(MySQL,mysql,数据库,sql)