• 显示数据库中的所有表和所有数据库


    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;

     

  • 相关阅读:
    为SharePoint 2010中的FBA创建自定义登录页面
    SharePoint 2010设置问卷调查权限
    无法创建您的个人网站,因为未启用“自助式网站创建”
    等级歧视的死循环[转]
    职业生涯中的10个致命错误
    项目经理须具备所有9 大知识领域
    项目管理工具和技术
    在SharePoint Server 2010中创建“我的网站”
    MATCH_PARENT是什么类型的布局
    Android 在代码中获取手机屏幕的宽高
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/3679904.html
Copyright © 2020-2023  润新知