zoukankan      html  css  js  c++  java
  • 数据库2

    列类型:

    1、日期时间型:year、timestamp、time、date、datetime

    2、字符串型:set、enum、blob、text、varchar、char

    3、整数型:

           1、整数型:tinyint、smallint、mediumint、int、bigint

           2、小数型:

                 1、浮点:float、double

                 2、定点:decimal

    表定义语句:

    1、创建表:

                   1、基本形式:create table【if not exists】表名 【约束、索引函数】【表选项列表】

                   2、字段属性:not null不为空

                                          auto-increment:自增长

                                          unique:【key】设主键

                                          default:设置默认值

                                          comment:字段注释

                     3、索引设置:作用:提高查找速度

                                            索引类型:

                                                             1、普通索引:(字段名1,字段名2)

                                                             2、唯一索引:unique key(字段名1,字段名2)

                                                             3、主键索引:primary key(字段名1,字段名2)

                                                             4、全文索引:fulltext(字段名1,字段名2)

                      4、约束设置:类型:

                                                     1、主键约束:primary key(字段名1,字段名2)

                                                     2.唯一约束:unique key(字段名1,字段名2)

                                                     3、外键约束:foreign key(字段名1,字段名2)

                        5、非空约束

                        6、默认约束

                        7、检查约束

         表选项:1、comment=“表的注释”

                       2、charset=字符编码名称

                       3、auto-increment=起始整数

                       4、engine=表的储存引擎名

    2、修改表:增:alter table 表名 add   字段名  字段类型     字段属性

                       删:alter table 表名 drop 字段名

                       改:alter table 表名 change 原字段名 新字段名 新字段类型 新字段属性

                      修改表基本形式 :alter table 表名 修改语句1,修改语句2;

    4、删除表:drop   table 表名

    5、表的其他操作:

             1、显示所有表:show    tables

             2、显示表结构:desc   表名

             3、显示表的创建语句:show create   table    表名

                      

                    

  • 相关阅读:
    C#在WebApi 中使用Redis 的方法
    IList<> IEnumerable<> ReadOnlyCollection<> 使用方向
    winform DateTimePicker 设置成秒
    vs 在高分屏下开发 winform 配置
    eclipse spring插件
    request方法
    Nexus添加中央仓库
    eclipse 安装velocity插件
    java >> << .>>> 计算详解
    SheetJS 入门案例
  • 原文地址:https://www.cnblogs.com/lxl7806265/p/8393356.html
Copyright © 2011-2022 走看看