sql格式化工具

sql格式化工具不仅能够将sql语句进行高亮显示,还能够清除sql中的代码注释以及对sql语句进行格式化处理使代码更加的美观.

格式化:美化sql代码增强可读性

优化压缩:压缩sql代码体积

清除注释:去除多余的注释字符

高亮代码:使用明显的颜色显示sql语句

常用的sql语句有:

添加:

CREATE DATABASE 数据库名 [创建新的数据库]

CREATE TABLE 表名(字段列名a 类型,列名b 类型,...) [创建新的表]

ALTER TABLE 表名 ADD 列名 类型 [增加列]

alter table 表名 add constraint 主键名 primary key(字段a,字段b) [添加主键]

create [unique] index  索引名 on 表名称(字段名….) [创建索引]

create view 视图的名称 as select statement [创建新视图]

删除:

DROP DATABASE 数据库名 [删除数据库]

DROP TABLE 表名  [删除表]

ALTER TABLE 表名 DROP COLUMN 列名 [删除一个列]

alter table 表名 drop primary key(字段名称) [删除主键]

drop index  索引的名称 [删除索引]

drop view 视图的名称 [删除视图]

数据表操作:

选择  select * from 表名称 where 范围条件

插入  insert into 表名称 (表名a,表名b) values (值a,值b)

更新  update 表名称 set 列名=值a where 范围条件

删除  delete from 表名称 where 范围条件

排序  select * from 表名称 order by 列名a,列名b [desc]

查找  select * from 表名称 where 列名 like ’%查询词语%’

表数据统计操作:

平均  select avg(字段) as avgvalue from 表名称

最大  select max(...) as maxvalue from ...

最小  select min(...) as minvalue from ...

求和  select sum(...) as sumvalue from ...

总数  select count as totalcount from ...