zoukankan      html  css  js  c++  java
  • 十二、mysql 标识列

    标识列又称为自动增长列

    含义:可以不用手动的插入值,系统提供默认的序列值

    关键字:auto_increment

    特点:

      (1) 标识列必须和主键搭配吗?不一定,但要求是一个key

      (2) 一个表可以有几个标识列?至多一个。

      (3) 标识列的类型只能是数值型

      (4) 标识列可以通过SET auto_increment_increment=3设置步长

    通过show variables like ‘%auto_increment%’查看参数

    可以通过手动插入值设置起始值

      1、创建表时设置标识列

        Create table tab_identity(

        id int primary key auto_increment

        )

      2、修改表时设置标识列

        Alter table tab_identity modify column id int primary key auto_increment;

      3、修改表时删除标识列

        Alter table tab_identity modify column id int;

  • 相关阅读:
    HNOI 2006 BZOJ 1195 最短母串
    BZOJ 3029 守卫者的挑战
    Codeforces 401D Roman and Numbers
    ZJOI2010 数字计数
    BZOJ 3329 Xorequ
    Codeforces 235 C
    SPOJ 8222 Substrings
    BZOJ 1396 识别子串
    (模板)归并排序
    poj3122 Pie (二分)
  • 原文地址:https://www.cnblogs.com/nuochengze/p/12651375.html
Copyright © 2011-2022 走看看