zoukankan      html  css  js  c++  java
  • MySQL

    建表
    create table player(
        id int identity,
        card_id char(18),
        name varchar(10),
        sex enum('',''),
        age tinyint,
        tel char(11),
        balance decimal(7,3)
        );
    查看数据库下的所有表
    show tables from football;
    查看表结构
    show columns from football;
    查看表结构方式2
    desc player;
    查看创建表的完整语句
    show create table player;
    添加列
    alter table player add club varchar(30);
    在指定列后添加列
    alter table player add club varchar(30) after name;
    添加新列到最前面    
    alter table player add player_id char(10) first;
    修改列名    
    alter table player change name new_name varchar(30);
    修改列的数据类型
    alter table player modify name varchar(25);
    修改列的排列位置    
    alter table player modify name varchar(10) after id;
    删除列指定列
    alter table player drop club;
    修改表名    
    alter table oldname rename to newname;
    删除数据库表    
    drop table test1,test2;
    删除数据库表前检测表是否存在,不会报错    
    drop table if not exists test1,test2;
    清空表中数据,重置Identity(标识列,自增字段)
    相当于自增列会被初始化,重新从1开始记录。
    truncate table table_name
  • 相关阅读:
    spring boot 定时任务
    logger日志级别
    jstl与el结合常见用法
    sql 案例
    Python 环境
    java rsa加密解密
    app扫描二维码登陆
    TimerTask定时任务
    spring3+quartz2
    表关系
  • 原文地址:https://www.cnblogs.com/hsinfo/p/13643125.html
Copyright © 2011-2022 走看看