• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
海宝000
博客园    首页    新随笔    联系   管理    订阅  订阅

mysql语句

mysql语句

选择:select * from table where 范围

插入:insert into table1(field1,field2)values(value1,value2)

  栗子:

  insert into info(name,country,salary)

  values('名字1','china',1200.0),

  ('名字2','china',1900.0),

  ('名字3','USA',12000.0),

  ('名字4','UK',2000);

删除:delete from table where 范围

更新:update table1 set field1=value1 where 范围

查找:select * from table1 where field1 like '%value1%'(模糊匹配查找)

  栗子:查找name中某个人的信息

    select * from table where name like '%海%'

排序:select * from table order by filed1,field2[desc]

  栗子:select * from info order by name desc;

总数:select count(*) as totalcount from table(as 是重命名)

  栗子:

  select count(*) as totalCount from info # 查询表里面多少条记录

就和:select sum(field1) as sumvalue from table1

  栗子:

  select sum(salary) as sumSalary from info;

平均:select avg(field1)as avgvalue from table

最大:select max(field1) as maxvalue from table

最小:select min(filed 1)as minvalue from table

posted @ 2019-03-11 16:25  海宝000  阅读(100)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3