zoukankan      html  css  js  c++  java
  • 有关MySQL数据库命令

    phpstudy使用最终端打开数据库 :

      第一次打开默认的密码是:root。

    进入后对数据可以进行增删查改。

      show databases;  是查看数据库的指令

      注意:分号是数据库的结束符,没有加分号即使按回车,也代表这个命令没有结束。

      create database 数据库名; 是创建数据库

      drop database 数据库名; 是删除数据库

      use 数据库名; 进入某个数据库中

      上面是对数据库进行增删查改,下面是对数据表增删查改

      show tables; 查看数据表

      create table 表名(字段1,字段2,类型); 创建表

      drop table 表名; 删除表

      alert table 表名 rename 新表名; 修改表名

     进入表里对字段进行操作。

      alert table 表名 add ; 字段定义 ( 字段名,字段类型 都要写)

      desc 表名;  查看表的定义

      alert table 表名 drop 字段名; 删除字段

      alert table 表名 change 旧的字段名 字段定义; 修改字段

     给字段添加数据(记录)

      insert into 表名(id,age) value(值1,值2);  添加一条记录   

      insert into 表名 values(值1,值2); 添加不指定字段名的语法

      insert into 表名 values(值1,值2),(值1,值2),(值1,值2),(值1,值2); 多条记录添加

     查看记录

      select*from 表名; 查看所有的字段记录

      select id from 表名; 查看单个字段记录

      select id,age from 表名; 查看多个字段的记录 

    按条件查询

      select*from 表名 where 条件;

      条件表达式>   <   >=   <=   =   !=   and且   or或

     排序查询 

        select*from 表名 order by 字段名 [asc/desc]; (asc 由低到高, desc 由高到底)

     限制查询

        select*from 表名 limit2,5; 从第二个开始向后查询五个

     删除记录

        delete from 表名;  

        delete from 表名 where 条件表达式; 按条件删

     改数据

        update 表名 set 字段=值; 如果不带条件会把下面的记录全改了  

        

      

    所触及过的星空,哪怕牺牲所有,也竭力想要抵达的地方!
  • 相关阅读:
    faster with MyISAM tables than with InnoDB or NDB tables
    w-BIG TABLE 1-toSMALLtable @-toMEMORY
    Indexing and Hashing
    MEMORY Storage Engine MEMORY Tables TEMPORARY TABLE max_heap_table_size
    controlling the variance of request response times and not just worrying about maximizing queries per second
    Variance
    Population Mean
    12.162s 1805.867s
    situations where MyISAM will be faster than InnoDB
    1920.154s 0.309s 30817
  • 原文地址:https://www.cnblogs.com/lishaoxiong/p/10687421.html
Copyright © 2011-2022 走看看