
Postgre
文章平均质量分 81
_原来如此_
这个作者很懒,什么都没留下…
展开
-
Postgre注意细节
1.Postgre创建数据库时支持中文,但是表名尽量不要写成大写,字段也支持中文,但是字段不能以数字开头。2.Postgre查询表名是否存在:SELECT tablename FROM pg_tables WHERE tablename='temp_dlxshz'原创 2017-03-17 15:32:59 · 761 阅读 · 0 评论 -
SQL基本语法
一、基础1、说明:创建数据库CREATE DATABASE database-name2、说明:删除数据库drop database dbname3、说明:备份sql server--- 创建 备份数据的 deviceUSE masterEXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind转载 2017-03-17 19:04:53 · 966 阅读 · 0 评论 -
postgre删除数据表重复数据
select distinct * into t_sup_supcomm_copy from t_sup_supcomm;drop table t_sup_supcomm;select * into t_sup_supcomm from t_sup_supcomm_copy;drop table t_sup_supcomm_copy;原创 2017-03-16 10:41:03 · 818 阅读 · 0 评论 -
postgre按照某列前几位连接并显示
select left(comm_type,2) as comm_type_id,comm_type_name,sum(Sale_Total) as Sale_Total,store_id,dept_name from t_bi_storesaledayreport LEFT JOIN T_BI_COMMTYPE on left(t_bi_storesaledayreport.comm_typ原创 2017-03-16 10:43:30 · 384 阅读 · 0 评论 -
postgre——to_date使用
s_date=to_date(to_char(date_in,'yyyy-MM-dd'),'yyyy-MM-dd');date_in为time类型,s_date为date类型原创 2017-03-16 10:45:58 · 11892 阅读 · 0 评论 -
postgre——case、union、小计总计(GROUP BY ROLLUP)写法
//将几张不同表结构的数据全部合并在一起,使用了case、union,同时实现小计总计select case when t_all.temp_comm is null then '总计' else t_all.temp_comm end as temp_comm,commodity_name,guige,t_bi_commbaseinfo.comm_type_id,comm_type_name,原创 2017-03-16 10:47:46 · 2939 阅读 · 0 评论 -
postgre连接符
Postgre操作符和连接符转载 2017-03-17 09:40:39 · 5538 阅读 · 0 评论