MySQL 数据库的基本语法

253 阅读1分钟

select * from 表名
select 列名 from 表名

insert into 表名称 (列名,列名) values ('值','值')

update 表名称 set 列名='值',列名='值' where 列名=

delete from 表名 where 列名=

where 子句

限定选定的条件

and

同时满足多个条件    

or

满足条件之一    

order by

asc 表示升序(默认)

   select *from 表名 order by 列名 asc      

desc 表示降序

  select *from 表名 order by 列名 desc    

多重排序

  select *from 表名 order by 列名 desc,列名 as       

count(*)函数

查总数据条数

   select count (*) from 表名     

使用AS为列设置别名

   select count (*)as total from 表名