• mysql常用命令


    【mysql/oracle命令】
    1)desc 表名; 查询表结构
    2)select * from 表名; 查询表所有内容
    3)create table 表名(字段1 数据类型,字段2 数据类型....);创建表
    4)insert into 表名 values(‘数据’,‘数据’);增加表数据
    5)alter table 表名 add 字段 数据类型; 增加字段
    6)alter table 表名 modify 字段 新数据类型; 修改数据类型
    7)update 表名 set 字段名=值 where 字段名=取值; 修改表内容
    8)delete from 表名 where 字段名=值; 删除某行
    9)drop table 表名; 删除表所有
    10)select * from 表名 where 字段名=值; 单个查询
    11)select * from 表名 where 字段名 in(‘值’,‘值’); 多个查询
    12)select * from 表名 where 字段名 like ‘%’;模糊查询
    13)select substr (字段名 1.3)from 表名;查询某字段的前三位
    14)select * from A表 inner join B表 on A表.字段名=B表.字段名;内联
    15)select * from A表 left join B表 on A表.字段名=B表.字段名;左联
    16)select * from A表 rihgt join B表 on A表.字段名=B表.字段名;右联
    17)select * from A表 full join B表 on A表.字段名=B表.字段名;全联
    18)select count(字段名)from 表名;求分别总数
    19)select max(字段名)from 表名;求最大值
    20)select * from B 表 where 字段名in(select 字段名 from A表);根据A表的名字查出B表相对应的名字数据
    21)show PROCESSLIST 查看当前进程运行情况,看看有咩有锁表
    22)/*#mycat:sql=select 1 from return_exchange_main where sharding_flag= 'U010102_K'*/
    UPDATE order_main om inner JOIN order_dtl dtl on om.order_no=dtl.order_no SET dtl.update_time=NOW() where om.out_date='2019-08-10'; 关联表刷数据
    23) SELECT update_time FROM pos_order_payway ORDER BY update_time asc LIMIT 10; 升序查询
    SELECT update_time FROM pos_order_payway GROUP BY update_time desc LIMIT 10; 倒序查询
    24) select original_so_no, count(1) from original_so group by original_so_no having count(1) > 1;查询一个表中所有相同数据
    25) select DISTINCT(`status`) from supplier 查询不相同数据

  • 相关阅读:
    《SmartJs系列》屌丝逆袭,华丽转身,解读自定义ScrollBar(一)
    IE6/IE7下,li设置float后,行高变高问题__UL的padding-top Bug
    团队作业
    团队作业
    结对作业
    个人作业
    心得
    css3的自定义字体
    javascript中的call方法
    javascript对象访问
  • 原文地址:https://www.cnblogs.com/onelove1/p/14645723.html
Copyright © 2020-2023  润新知