mysql对表常用操作

  1. NEXTONE :create
    create table testtable(
    id int(10) not null auto_increment primary key comment '',
    name varchar(20) not null character set utf8 comment '',
    age  int null comment '',
    gender char(2) coment '',
    gmt_created datetime not null comment ''
    )engine=innoDB default charset=utf8;
  2. Set the increment sequence: auto_increment
    Set the primary key: primary key
    Label: comment.
    Set the field is not empty: not null
    Set the field be empty: null
    Format: character set utf8
    Char fixed length variable length, varchar
    Time type: datetime
  3. NEXTTWO:insert,updae,delete,select pass
  4. NEXTTHREE:alert:
    1.delete column
     alter talbe table drop column
    2.alert rename
     alter table table rename new_table
    3.alter drop primary key
     alter table table drop primary key
    4.alter add primary key
     alter table sj_resource_charges add constraint pk_sj_resource_charges primary key (resid,resfromid)
    5.add column
     alter table table add column_name type not null comment ''
    6.change column type
     alter table table change column_name new_column_name type not null comment ''
    7.alter index_name
     alter table table add colunm index_name(index_column_name)
    8.alter drop index emp_name
     alter table table drop index index_column_name
    NEXTFOUR:
    drop
    Structure of the drop statement will delete tables are dependent constraints (constrain), trigger (trigger), index (index) depends on the table;
    The stored procedure / function will be retained, but to the invalid state.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值