• MySQL更新(修改、查询)


    更新 update<表名>set<列=值>where…

    #修改 update(修改)info set sex=‘1’where code=‘p003

    ’单列 update        info set sex=‘0’

    nation='n004'birthday='1999-9-9'where code='p001' update car set price=price*0.9 where price>30 update car set price=price*0.95 where

    (brand='b006'||brand=‘b005’)&&price>30 #查询 select*from表名 select 列名1,列名2… from表名       --投影 select*from表名where条件            --筛选 1.等值与不等值 精确查 select * from car where code='c001'; select * from car where code != 'c001'; select * from car where price > 30; --下面的都是范围 select * from car where price >=30 && price <=50; select * from car where price between 30 and 50 select * from car where brand='b002' ||

    brand='b004' || brand='b006' select * from car where brand in

    ('b002','b004','b006')

    between a and b a和b之间 select*from car select name,price from car select*from car where price>40 select*from car where price>=30&&price<=50 select*from car where price between30and50 select*from car where brand='b002'||

    brand='b004'||brand='b006' select*from car where brand ni(b002,b004,b006) select*from car where brand not in(b002,b004,b006) 2.模糊查

    select*from表名where 列名 like宝马%’ %任意的代替

    select*from表名where 列名 like'5%' select*from表名where 列名 like'%型' select*from表名where 列名 like'_5% 3.排序* from表名where…order by列名[ASC/DESC]列名

    [asc/desc]… select * from car order by  price desc select * from car order by brand desc,price asc

  • 相关阅读:
    凤凰网CEO刘爽称鄙视微博连说20个屁示不齿
    科技创业网站
    梦想,在路上
    小本创业
    rails relevent
    MBA = married but available
    把UTF8编码转换为GB2312编码[转]
    FSFS和VDFS存储方式的区别
    如何让phpmyadmin输入密码再进入
    dede后台登陆后一片空白的解决办法汇总
  • 原文地址:https://www.cnblogs.com/naqiang/p/5527595.html
Copyright © 2020-2023  润新知