常用sql语句总结
2015-04-01 15:16
211 查看
1、create database Student;//创建数据库student
2、Use student;//换到数据库student
3、Show databases;//查看所有的数据库
4、Show database like ‘%t%’;查看满足。。条件的数据库
5、Show create database student;//查看数据库定义
6、Show create table booka;// 查看表定义
7、Create table name();//创建表
8、drop database 名字//删除数据库
9、alter database 数据库名 charset gbk//修改数据库选项
10、create database if not exists 库名//如果不存在则创建
11、drop database if exists 库名//如果存在,则删除
12、est.itcast //test库内itcast表
13、desc 表名//查看表结构
14、rename table原表名 to 新表名//改表名
15、alter table table_name add column 字段定义 [字段位置]//增加字段
给stu表增加一个age字段:alter table stu add column age int;
16在name后增加一个height字段
alter table stu add column height int after name;
17在最开始增加一个字段
alter table stu add column height int first;
18删除字段height
Alter table stu drop column height;
19、修改已有字段
alter table table_name modify column column_name 新的定义!
20、insert into 表名 (字段列表) values (与字段相对的值列表)
21、select 字段列表 from 表名 [where 条件表达式]
22、delete from 表名 where 条件
23 update 表名 set 字段=新值, 字段n=新值n where 条件
2、Use student;//换到数据库student
3、Show databases;//查看所有的数据库
4、Show database like ‘%t%’;查看满足。。条件的数据库
5、Show create database student;//查看数据库定义
6、Show create table booka;// 查看表定义
7、Create table name();//创建表
8、drop database 名字//删除数据库
9、alter database 数据库名 charset gbk//修改数据库选项
10、create database if not exists 库名//如果不存在则创建
11、drop database if exists 库名//如果存在,则删除
12、est.itcast //test库内itcast表
13、desc 表名//查看表结构
14、rename table原表名 to 新表名//改表名
15、alter table table_name add column 字段定义 [字段位置]//增加字段
给stu表增加一个age字段:alter table stu add column age int;
16在name后增加一个height字段
alter table stu add column height int after name;
17在最开始增加一个字段
alter table stu add column height int first;
18删除字段height
Alter table stu drop column height;
19、修改已有字段
alter table table_name modify column column_name 新的定义!
20、insert into 表名 (字段列表) values (与字段相对的值列表)
21、select 字段列表 from 表名 [where 条件表达式]
22、delete from 表名 where 条件
23 update 表名 set 字段=新值, 字段n=新值n where 条件
相关文章推荐
- 6种常用的sql语句总结收藏
- Sqlite3常用SQL语句总结,一是防止自己忘了,二是分享
- ORACLE 常用SQL语句总结
- SQL常用语句总结
- 常用Sql语句总结
- 6种常用的sql语句总结
- DB2比较常用与实用sql语句总结
- sql常用语句集合(工作总结)
- SQL查询语句常用总结
- sql常用语句总结
- Sql常用语句 and Sql常见面试题(总结)
- SQL查询语句常用总结
- 总结经典常用的SQL语句(1)
- 关于过去工作的一些总结:常用sql语句以及数据库查询优化
- 一些常用SQL语句的总结
- SQL常用流程控制语句总结来源
- 总结经典常用的SQL语句(2)
- 总结经典常用的SQL语句(2)
- SQL常用语句总结
- 常用SQL语句总结<一>