Oracle 11G exp 导出空表操作

1、先查询一下当前用户下的所有空表
select table_name from user_tables where NUM_ROWS=0;

2、用以下这句查找空表
select ‘alter table ‘||table_name||’ allocate extent;’ from user_tables where num_rows=0

把第二步查询结果导出的内容在SQL执行后,再导出即可。

[转]在NopCommerce中新建数据表、新建实体Model步骤

本文转自:http://www.cnblogs.com/aneasystone/archive/2012/08/27/2659183.html

在NopCommerce中新增一个Domain Model,需要以下几个步骤:

1. 新建一个Entity Class (Nop.Core.Domain/Entity.cs)

2. 新建一个Mapping Class (Nop.Data/Mapping/EntityMap.cs)

3. 新建一个View Model (Nop.Admin.Models/EntityModel.cs 或 Nop.Web.Models/EntityModel.cs)

4. 新建Model Validator (Nop.Admin.Validators/EntityValidator.cs 或 Nop.Web.Validators/EntityValidator.cs)

5. 为AutoMapper新建映射配置,用来完成Model和Entity之间的转换 (Nop.Admin.Infrastructure/AutoMapperStartupTask.cs 或 Nop.Web.Infrastructure/AutoMapperStartupTask.cs)

6. 编写ToModel和ToEntity (Nop.Admin/MappingExtensions.cs 或 Nop.Web/MappingExtensions.cs)

7. 创建Service和Service Interface (Nop.Services/EntityService.cs 和 Nop.Services/IEntityService.cs)

8. 最后新建的Model创建Controller和View

PS: NopCommerce不支持database migration,需要手动更新数据库。

参考资料:http://www.nopcommerce.com/docs/73/updating-an-existing-entity-how-to-add-a-new-property.aspx

Nopcommerce 设置必须登陆

如需将搭建好的商城设置为必须登陆才能访问商品信息,可以按照如下设置:
登陆“后台管理”,选择“商城配置”,“访问控制”菜单。按照如下图将Guest权限勾选去除即可。
保存后效果就是访问前台默认跳转到登陆页面。
20161206140459

Oracle SQL语句去重查询、整理数据

Oracle等数据库在查询时去除重复结果的关键字是distinct,使用例子:select distinct * from tb_table where 1=1,这样执行的查询结果会将完全单行完全重复的数据排除出去。

但这里主要记录的是,将表中的重复数据排除出来的语句,一般来讲当我们想要把重复的冗余数据删除掉时,下面的语句给予我们帮助。

1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断

select * from people
where peopleId in (select peopleId from people group by peopleId having count
(peopleId) > 1)

2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录

delete from people
where peopleId in (select peopleId from people group by peopleId having count
(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId
)>1)

3、查找表中多余的重复记录(多个字段)

select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having
count(*) > 1)

4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录

delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having
count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录

select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having
count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

source:http://www.jb51.net/article/34820.htm