zoukankan      html  css  js  c++  java
  • sql语句

    快速建表:

    CREATE TABLE IF NOT EXISTS `0708`(
       `pid` INT UNSIGNED AUTO_INCREMENT,
       `name` VARCHAR(100) NOT NULL,
       `birthday` DATE,
       PRIMARY KEY ( `pid` )
    )ENGINE=InnoDB DEFAULT CHARSET=utf8;
    

    修改表名称:

    alter table test.0708 rename to test_table;
    

    查看表结构:

    mysql> desc test_table;
    +----------+------------------+------+-----+---------+----------------+
    | Field    | Type             | Null | Key | Default | Extra          |
    +----------+------------------+------+-----+---------+----------------+
    | pid      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | name     | varchar(100)     | NO   |     | NULL    |                |
    | birthday | date             | YES  |     | NULL    |                |
    +----------+------------------+------+-----+---------+----------------+
    
    

    插入数据:

    insert into test_table (pid, name, birthday) values ('5', 'xiuer','1996-10-02'), ('12','lisi','2015-10-04'),('11','wangwu','2016-09-02'),('13','zhaoliu','2015-10-07');
    

    查看数据:

    mysql> select * from test_table;
    +-----+----------+------------+
    | pid | name     | birthday   |
    +-----+----------+------------+
    |   5 | xiuer    | 1996-10-02 |
    |   8 | zhangsan | 2016-02-13 |
    |  11 | wangwu   | 2016-09-02 |
    |  12 | lisi     | 2015-10-04 |
    |  13 | zhaoliu  | 2015-10-07 |
    +-----+----------+------------+
    
    非聚簇索引:
    ```shell
    mysql> create index fpid on test_table(name);
    Query OK, 0 rows affected (0.02 sec)
    
  • 相关阅读:
    Lock
    synchronized
    线程可见性与原子性
    线程安全问题
    MySQL索引背后的数据结构和原理
    求一颗二叉树中两个节点的最低公共父节点
    Session not active, could not store state 的解决方法
    https nginx 设置
    第三方支付系统
    facebook页面种简单测试js调用flash开放的js接口的方法
  • 原文地址:https://www.cnblogs.com/sihye/p/13266611.html
Copyright © 2011-2022 走看看