简单查询
1,查询所有字段
select * from test
2,查询单个字段
select name from test
3,查询表的多个字段
select name,age from test
4,给字段命名
第一种方式
select name as n,age as a from test
第二种方式 也可以把as 去掉
select name n,age a from test
5,给表命名也跟字段命名一样
select * from test as t
也可以去掉
where语句 用于满足条件的记录
1,简单的where查询
select * from test where name='小明‘
2,where 语句的运算符
=
<=
between
like
in
=
<>
<
AND & OR 运算符
1.and
select * from test where name='小明 ' and age=12
2.or
select * from test where name='小明 ' or age=12
Oreder by 关键字 ,对查询的结果进行排序
1,升序查询
select * from test order by id desc
2,倒叙查询
select * from tet order by id asc
insert into 像表里插入数据
insert into test(name,age) values('你好',12)
update 修改表里面的数据
update test set name = 'nihao' where id=1
delete 删除表里面的数据
delete from test where id=1