mysql 第一天

1.创建数据库
create database test
2.查询数据
show databases
3.删除数据
drop database test
4.使用数据库
use test
5.查看数据库test 有多少张表
use test
show tables
6.在test中创建新表
create table student(id int not null primary key,name varchar(20) not null unique)
7.查看student的表机构情况
desc student
8.student表中增加一个字段age,类型为int类型
alter table student add age int
9.需要删除birthday字段
alter table student drop column age
10.向student表中插入数据
insert into student values(1,*,*)
或者 insert into student() values()
11.查询student表
select * from student
12.进行条件查询
select name,age from student where id = 2
13.修改id=2的name字段查询student表中的记录总数
select count(*) from student
14.修改id=2的name字段
update student set name = 'Tom' where id =2
15.删除id=2 的记录
delete from student where id = 2

猜你喜欢

转载自www.cnblogs.com/lusix/p/11350188.html