zoukankan      html  css  js  c++  java
  • mysql学习02

    清空数据库的内容

    drop table tb1; #直接删除表
    
    delete from tb1; #清空表的内容
    truncate table tb1;清空标的内容,速度快 自增数字会从零开始重新计数
    mysql> desc student;
    +----------+-------------+------+-----+---------+----------------+
    | Field    | Type        | Null | Key | Default | Extra          |
    +----------+-------------+------+-----+---------+----------------+
    | sid      | int(11)     | NO   | PRI | NULL    | auto_increment |
    | sname    | varchar(25) | YES  |     | NULL    |                |
    | gender   | varchar(2)  | YES  |     | NULL    |                |
    | class_id | int(11)     | YES  |     | NULL    |                |
    +----------+-------------+------+-----+---------+----------------+
    4 rows in set (0.01 sec)
    
    mysql> desc class;
    +---------+-------------+------+-----+---------+----------------+
    | Field   | Type        | Null | Key | Default | Extra          |
    +---------+-------------+------+-----+---------+----------------+
    | cid     | int(11)     | NO   | PRI | NULL    | auto_increment |
    | caption | varchar(25) | YES  |     | NULL    |                |
    +---------+-------------+------+-----+---------+----------------+
    2 rows in set (0.01 sec)
    
    mysql> alter table student add constraint fk_stu_cls foreign key student(class_id) references class(cid);
    Query OK, 0 rows affected (0.38 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql>

    277

    https://www.cnblogs.com/wupeiqi/articles/5713315.html

    https://www.cnblogs.com/wupeiqi/articles/5729934.html

  • 相关阅读:
    PAT 甲级 1132 Cut Integer (20 分)
    AcWing 7.混合背包问题
    AcWing 9. 分组背包问题
    AcWing 5. 多重背包问题 II
    AcWing 3. 完全背包问题
    AcWing 4. 多重背包问题
    AcWing 2. 01背包问题
    AcWing 875. 快速幂
    AcWing 874. 筛法求欧拉函数
    AcWing 873. 欧拉函数
  • 原文地址:https://www.cnblogs.com/Mengchangxin/p/9658133.html
Copyright © 2011-2022 走看看