DML命令和DQL命令

DML命令和DQL命令
//插入数据
     单条数据
  insert into 表名 (字段列表) values (值列表)
     多单数据记录
  insert into 表名 (字段列表) vaules (值列表1),(值列表2),...,(值列表n);
注意:为避免结构变化引起的错误,建议插入数据数据时写明具体字段
// 数据查询
     #基础
  select 字段1,字段2,...,字段n from 表名 where 条件;
     #复制
  create table 新表名 (select 字段1,字段2,... from 旧表名);
    #子查询
  select 字段 form 表1 where 字段1 比较运算符 (子查询);
     #in子查询
   select 字段 form 表名 where 字段 in(a,b,c...);
     #空行
   select 字段名 from 表名 where 字段 is null;
    #列别名
  select 字段1 as '别名’,... from 表名 where 条件;
    #order by子句
  boder by子句实现按一定顺序显示
     asc 升序
     desc 降序
    #limit子句
  limit [ 位置偏移量 ] [ 行数 ];
        位置偏移量=行数*(页数-1)
//更新数据
    update 表名 set 字段1=值1, 字段2=值2,...,字段n=字n where 条件;
//删除数据
    delete from 表名 where 条件 ;
    truncate table 表名;
注意:truncate语句删除后将重置自增列,表结构及其字段、约束、索引保持不变,执行速度比
delete快。
//常用函数
   #聚合函数

   #字符串函数

   #时间日期函数

   #数学函数

原文地址:https://www.cnblogs.com/gnos/p/13163703.html