zoukankan      html  css  js  c++  java
  • mysql-索引

    创建test表

    create table test(
    id int,
    name varchar(10) not null,
    age int default 18,
    passwd varchar(12),
    article text
    );

    主键索引

    alter table test add primary key auto_increment (id);

    唯一索引

    alter table test add unique (name);       (可同时添加多个字段)

    普通索引

    alter table test add index (age);  (可同时添加多个字段)

    全文索引

    alter table test add fulltext (article);

    mysql> show create table testG
    *************************** 1. row ***************************
           Table: test
    Create Table: CREATE TABLE `test` (
      `id` int(11) NOT NULL,
      `name` varchar(10) NOT NULL,
      `age` int(11) DEFAULT '18',
      `passwd` varchar(12) DEFAULT NULL,
      `article` text,
      PRIMARY KEY (`id`),
      UNIQUE KEY `name` (`name`),
      KEY `age` (`age`),
      FULLTEXT KEY `article` (`article`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    1 row in set (0.00 sec)
  • 相关阅读:
    JavaWeb笔记
    Session案例_登录注销
    会话
    Cookie入门
    jsp入门
    if else优化
    cheap-source-map--不显示源码 、source-map--显示源码 、 eval--最快的编译办法
    npm run dev 克隆报错
    $emit和$on的用法
    npm
  • 原文地址:https://www.cnblogs.com/tangpg/p/8724025.html
Copyright © 2011-2022 走看看