zoukankan      html  css  js  c++  java
  • mysql学习笔记

    1、 进入数据库     mysql  -u 用户名 -p 密码

       2、 导出数据库      mysqldump  -u 用户名 -p 密码 数据库名(表名)> 路径 备份.sql

       3、 导入数据库      mysql  -u 用户名 -p 密码 数据库名< 路径 备份.sql

           或者进入mysql,使用source  路径 备份 此方法可以单独导入表

       4、 显示所有数据库   show databases;

       5、 使用数据库       use 数据库名;

       6、 显示所有表       show  tables;

       7、 创建数据库       create database 数据库名;

       8、 创建表            create table 表名(变量名 变量类型(大小)约束条件,变量名  变量类型(变量大小)约束条件,primary key(主键) );

       9、 描述表             describe 表名;

       10、向表中输入数据    insert into 表名 values(                );

       11、select 列 from 表 order by 列  desc/asc

           select count(*)  from 表名                         统计表中记录总数

           descending   降序排列的意思

           ascending  升序排列

       12、删除表内容

           delete  from 表名 

           truncate  table 表名

       13、更新表内容

           update table 表名 set='  '  where 条件

       14、改变表结构

           alter table 表名 add  id  int(10)  【列名 数据类型】  增加列

           alter table 表名 drop  id    【列名】                  删除列

           alter table 表名 modify  id  int(6);                     修改列

       15、改变表名

           rename  table 表名1 to 表名2

       16、查看数据库、表创建信息

           show  create  database 数据库名 

           show  create  table  表名 

        17、过滤表中重复的信息

            select distinct 列名 from 表名

  • 相关阅读:
    [PHP] php调用不存在的方法会自动调用 __call 魔术方法
    [PHP] laravel框架响应json信息中文禁止unicode编码
    [PHP] php中的trait代码复用方式
    [nginx] 解决:upstream timed out (110: Connection timed out) while reading response header from upstream
    [linux] Linux下格式化JSON程序-jq
    [git] Git Clean 清除 untrack 没有加入版本库的文件
    goland终端如何导入github上的包
    calico 配置 BGP Route Reflectors
    改善 Kubernetes 上的 JVM 预热问题
    golang开源对象存储
  • 原文地址:https://www.cnblogs.com/brightbrother/p/7522855.html
Copyright © 2011-2022 走看看