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;

     

  • 相关阅读:
    JQuery 图片轮播
    js版的虚线框
    折叠菜单,选择下拉(手风琴)
    logstash的index值可以为中文
    假如正则从来没来过,我们该如何去匹配一个字符串?
    深度解析javascript中的浅复制和深复制
    笔试题
    前端笔试题总结---持续更新
    清除浮动
    一步一步的理解闭包
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/3679904.html
Copyright © 2011-2022 走看看