zoukankan      html  css  js  c++  java
  • 显示数据库中的所有表和所有数据库

    MSSQL中查询所有数据库

    方法1:select * from sysdatabases;

    方法2:exec sp_helpdb(使用存储过程查询)

    MSQL中查询数据库中的所有表

    方法1:select * from sysobjects;

    方法2:exec sp_help(使用存储过程查询)

    MySQL中查询所有数据库

    show databases;

    MySQL数据库中查询所有表

    show tables;

    --------------------------------

    插入一个表中的数据有三种方法:

    1、insert into student values(5,116,26,90); // 即插入这一行的数据个数、类型一致。 即student里面的所有字段。

    或者insert into student(id,name) values(5,116);

    2、insert into student set name=116,id=5;

    3、复制一个表 insert into student2 select * from student; 

    ------------------------------------

    select * from student where classGrent between 20 and 30;

    ------------------------

    create database 数据库名;
    create table student2(id int(8),name varchar(12),classGrent varchar(12) result varchar(12)); 创建表
    ------------------
    alter table 表名 rename to 新表名
    -------------------------------------
    更新表中数据
    mysql>update MYTABLE set sex="f" where name='hyq'; 

    update newstudentinfo set name='zhangsan' where id=1; 

    --------------------------------------------------------------

    修改表中的某个字段

    修改某个表的字段类型及指定为空或非空
    >alter table 表名称 change 字段名称 字段名称 字段类型 [是否允许非空];
    >alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

    >alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

    修改字段名:

         alter table     tablename    change   old_field_name    new_field_name  old_type;

     

  • 相关阅读:
    深入理解网卡配置bond的意义和作用
    关于B站UP主墨茶official逝世的感想
    Python内置函数学习笔记
    Python学习笔记(4)
    测试工作中不可忽略的点
    Python学习笔记(3)
    Python学习笔记(2)
    Python学习笔记(1)
    docker-compose部署
    Xtrabackup源码安装
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/3679904.html
Copyright © 2011-2022 走看看