• DDL-表的管理


    一、创建表 ★
    create table 【if not exists】 表名(
        字段名 字段类型 【约束】,
        字段名 字段类型 【约束】,
        。。。
        字段名 字段类型 【约束】

    )

    二、修改表

    1.添加列
    alter table 表名 add column 列名 类型 【first|after 字段名】;
    2.修改列的类型或约束
    alter table 表名 modify column 列名 新类型 【新约束】;
    3.修改列名
    alter table 表名 change column 旧列名 新列名 类型;
    4 .删除列
    alter table 表名 drop column 列名;
    5.修改表名
    alter table 表名 rename 【to】 新表名;

    三、删除表
    drop table【if exists】 表名;

    四、复制表
    1、复制表的结构
    create table 表名 like 旧表;
    2、复制表的结构+数据
    create table 表名
    select 查询列表 from 旧表【where 筛选】;







  • 相关阅读:
    Mysql
    JavaScript常用事件
    css
    HTML
    判断pc还是手机打开跳转到别的网页
    queue 队列
    兼容firstChild和firstElementChild
    总结各种width,height,top,left
    原生js提取非行间样式
    ie8 不支持media
  • 原文地址:https://www.cnblogs.com/yue-170305/p/10722822.html
Copyright © 2020-2023  润新知