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

  • 相关阅读:
    网络设备操作命令
    "Realtek PCIe GBE Family Controller"网卡抓带Vlan Tag的包
    ubuntu16.04 samba 配置
    readelf -s 命令‘symbol’名字显示不全
    APUE Unix环境高级编程读书笔记
    Jmeter之文件上传
    百度去广告chrome插件
    zookeeper的安装与使用
    spring中bean获取工具
    关于maven的一些记录
  • 原文地址:https://www.cnblogs.com/Mengchangxin/p/9658133.html
Copyright © 2011-2022 走看看