zoukankan      html  css  js  c++  java
  • 数据库常用命令


    1、进入mysql
    mysql -uroot -ppassword
    2、查看数据库
    show databases;
    3、进入某个数据库
    use zhiwen;
    4、查看知问表
    show tables;
    5、查看表内容
    select * from comment;
    6、删除表的某一行数据
    delete from comment where id=25;
    7、修改表的某一行数据
    update coment set user='hyt111' where id=27;
    8、表中新增一行数据
    insert into comment(id,titleid,user,....) values ('111','111','aaa','bbb',...);
    9、创建数据表
    show databases;
    use zhiwen;
    mysql> create table MyClass(
    > id int(4) not null primary key auto_increment,
    > name char(20) not null,
    > sex int(4) not null default '0',
    > degree double(16,2));
    10、删除数据表
    drop table myclass;
    11、修改表名称
    rename table MyClass to YouClass;
    12、建库和建表的实例
    create database school;
    use school;
    create table teacher
    (
        id int(3) auto_increment not null primary key,
        name char(10) not null,
        address varchar(50) default ‘hz’,
        year date
    );

    //以下为插入字段
    insert into teacher values(”,’allen’,'大连一中’,'1976-10-10′);
    insert into teacher values(”,’jack’,'大连二中’,'1975-12-23′);

  • 相关阅读:
    AC自动机模板
    输入输出外挂(整数)
    前同事通过接私活年入60W,他常用19个私活平台汇总!
    通用分页存储过程
    单品流向
    口令对照表
    连接字符串大全
    各搜索引擎登记入口
    moto手机软件收集
    resin在线客户系统
  • 原文地址:https://www.cnblogs.com/httandytt/p/5991025.html
Copyright © 2011-2022 走看看