• mysql学习笔记 第四天


    mysql引擎:
      archive(档案)[数据插入以后不能被修改,只读]
      blackhole[这种写操作是删除数据,读操作是返回空白记录]
      CSV[在储存数据时以逗号作为数据项之间的分隔符]
      example[示例(存根)储存引擎]
      Falcon[用来进行处理事务的储存类型]
      federated[用来访问远程数据表的储存引擎]
      InnoDB[具备外键支持功能的事务处理引擎]
      memory[内存里的数据表]
      merge[用来管理多个MyISAM数据表构成的数据表集合(merg-myisam)]
      myisam默认的储存类型
      NDB[mysql clustor 专用引擎]

    第二部分:
      no_engine_substitution设置不用默认的引擎(当创建数据表类型时不成功)
      使用default-storage-engine启动服务器,使用一种默认的储存引擎
      show create table table_name=select condition from information_schema.tables[查看默认引擎]
      使用min-Rows=n对memory引擎的优化
      eg:
        create table table_name{...}engine=memory min-rows=100;
      使用max-rows和avg-row-length控制myisam的大小
      改变数据表的引擎:alter table table_name type[engine]=type_name
      对于创建表格时使用if not exist可以检查是否具有相同的表格,但具有一定的风险,使用drop table if exist再执行create table

    临时表:
      创建临时表格:create temporary table table_name (也支持各种引擎),暂时性表的生命周期一般是在服务器停止临时表类型
          可以和永久性表格同名,但是永久性表格会暂时性的失效,直到暂时性表失去效果。

    使用like和select从其他数据表中创建新的数据表
      create table table_name like _table_name,这样创建的新数据表具有相同的类型,索引,顺序,
      insert into table_name select ...[select 后插入的是表数据或者其他数据],可以使用这个方法创建
      一个临时性的副本:temporary
      向副本中插入其他表数据eg:insert into new_table_name select * from table_name[where...];
      使用create table table_name select 将上面两种类型一步到位,但是这种情况的数据可能对视索引或者可能失去数据属性
      但是其中可以使用cast()强制类型.
      在create table 部分提供明确定义,之后再select 部分使用那些定义检索:
      create table mytd1(i int unsigned,t time,d decmal(10,5))
      select i as i,cast(curtime() as time) as t,-----------------(这段话没看懂意思==。)
      ps:select 字句选择填入数据要求。

    merge数据表:
      merge将myisam当做一个连接单元来处理,构成一个merge数据表的各个成员具有相同的顺序,数据类型,索引等,
      eg:
        create table log_ccyy
        ( dt datetime not null,
         info varchar(100) not null,
         index(dt)
        );
        ccyy是年份的意思,假设创建log_2010,log_2011,以后在创建一个merge类型的:
        create table log_merge
        (dt datetime notnull,
        info varchar(100) not null
        index(dt)

        )engine=merge union=(log_2010,log_2011)
        [insert_method=[nofirstlast]];
        在创建新的merge单元的时候(myisam表类型),插入的位置first或者last或者no不允许插入新的数据表
        log_merge中加入数据表log_2012:
                  alter table log_merge=(log_2010,log_2011,log_2012)

  • 相关阅读:
    POJ 1113 Wall
    POJ 3525 Most Distant Point from the Sea
    POJ 3335 Rotating Scoreboard
    POJ 1228 Grandpa's Estate
    POJ 1873 The Fortified Forest
    POJ 2354 Titanic
    POJ 3130 How I Mathematician Wonder What You Are!
    POJ 1106 Transmitters
    POJ 1474 Video Surveillance
    seajs 的研究一 无题
  • 原文地址:https://www.cnblogs.com/zr520/p/3925610.html
Copyright © 2020-2023  润新知