zoukankan      html  css  js  c++  java
  • MySQL 清空表的内容

    (1)delete form 表名,清空表的内容

    mysql> use test;
    Database changed
    mysql> create table teacher(age int(3));
    Query OK, 0 rows affected (0.07 sec)
    
    mysql> insert into teacher values(111), (45), (23), (34);
    Query OK, 4 rows affected (0.04 sec)
    Records: 4  Duplicates: 0  Warnings: 0
    
    mysql> select * from teacher;
    +------+
    | age  |
    +------+
    |  111 |
    |   45 |
    |   23 |
    |   34 |
    +------+
    4 rows in set (0.00 sec)
    
    mysql> delete from teacher;
    Query OK, 4 rows affected (0.03 sec)
    
    mysql> select * from teacher;
    Empty set (0.00 sec)
    
    mysql>

    (2)truncate 表名,清空表的内容

    mysql> use test;
    Database changed
    mysql> create table teacher(age int(3));
    Query OK, 0 rows affected (0.05 sec)
    
    mysql> insert into teacher values(111), (45), (23), (34);
    Query OK, 4 rows affected (0.03 sec)
    Records: 4  Duplicates: 0  Warnings: 0
    
    mysql> select * from teacher;
    +------+
    | age  |
    +------+
    |  111 |
    |   45 |
    |   23 |
    |   34 |
    +------+
    4 rows in set (0.00 sec)
    
    mysql> truncate teacher;
    Query OK, 0 rows affected (0.11 sec)
    
    mysql> select * from teacher;
    Empty set (0.00 sec)
    
    mysql>
  • 相关阅读:
    TweenMax_API介绍
    正则表达式基础讲解
    CSS3 calc()的使用
    WebGL框架 -- three.js
    CSS3 box-sizing属性
    prefixfree.js_无前缀脚本
    css样式—字体垂直、水平居中
    JQuery解析json数据
    移动Web开发规范
    Ajax与json在前后端中的细节解惑
  • 原文地址:https://www.cnblogs.com/Robotke1/p/3054958.html
Copyright © 2011-2022 走看看