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 字段名稱 字段類型 [是否允許非空];