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

  • 相关阅读:
    Delphi TWebBrowser[11] 读写html代码
    Nginx 配置反向代理
    清除git中缓存的凭证(用户名及密码)
    python 摄像头
    a 链接控制打开新窗口 无地址栏
    树形多级菜单数据源嵌套结构与扁平结构互转
    使用 git 的正确姿势
    JavaScript this
    JavaScript Scope Chain
    JavaScript Scope Context
  • 原文地址:https://www.cnblogs.com/Mengchangxin/p/9658133.html
Copyright © 2011-2022 走看看