• 1 简单的命令集合


    show databases; 查看数据库

    begin; rollback; commit;

    use text; 切换数据库
    Database changed 数据库已经切换
    create database texts; 创建数据库

    drop database texts; 删除数据库

    create database text default character set utf8 collate utf8_general_ci; 创建数据库+字符集

    select * from student; #表的内容

    show tables; 查考表

    describe student #设计表
    或者 desc student;

    auto_increment; #自增长

    primary key; 主键

    alter table student rename student2; 改表名

    alter table student add id int ; 增加字段

    alter table student change id ids varchar not null; 更该字段名

    alter table student drop id ;(删除字段)

    alter table student add constraint pk-name primary key student (name); #添加主键

    alter table student add constraint fk-name foreign key (id) references person (id); #添加外键

    show engines #查看搜索引擎

    show variables like 'storage_engine%';

    insert into [表名] values (值);#插入数据

    create tabel 新表 ( select * from student );

    update 表名 ste 列名 = 更新值 where 更新条件;

    delete from 表名 where 条件;

    truncate table student; #删除字段

    select <列名|表达式|函数|常量>
    from <表名>
    where <条件>
    order by <排序的列名> [ ASC 或 DESC]

  • 相关阅读:
    2015-SH项目总结
    2015年总结
    [css]我要用css画幅画(七)
    [css]我要用css画幅画(六)
    [css]我要用css画幅画(五)
    [css]我要用css画幅画(四)
    [css]我要用css画幅画(三)
    程序遇到问题需要关闭
    ASP.NET Core 验证:(二)介绍ASP.NET Core的 Indentity
    ASP.NET Core 验证:(一)概述
  • 原文地址:https://www.cnblogs.com/L-o-g-i-c/p/8278511.html
Copyright © 2020-2023  润新知