How to get the mapping relationship between two columns in a table
If a table have column A and B
Count(distinct A) as Da
Count(distinct B) as Db
Count(distinct A, B) as Dab
The Da/Db<=Dab, this will be always true;
1. if(Da=Db=Dab) => A:B as 1:1
2. if(Da<(Db=Dab)) => A:B as 1:N
3. if(Db<(Da=Dab)) => A:B as N:1
4. if(Da!=Db!=Dab) => A:B as N:N //relashionship is mess
For example for 4, how to generate the smaple data, first build a 1:N and then change the column to be N:N, like below
1 2
1 3
1 4
2 5
=>
1 2
1 3
1 4
2 4
Da=2, Db=3,Dab=4
How to get the mapping relationship between two columns in a table的更多相关文章
- Database: key
super-key: Any key that has more columns than necessary to uniquely identify each row in the table i ...
- [转]Entity Framework Fluent API - Configuring and Mapping Properties and Types
本文转自:https://msdn.microsoft.com/en-us/data/jj591617#1.2 When working with Entity Framework Code Firs ...
- SAP CRM One order里user status和system status的mapping逻辑
Below example show: How the mapping relationship between User status and System status maintained in ...
- JavaPersistenceWithHibernate第二版笔记-第六章-Mapping inheritance-004Table per class hierarchy(@Inheritance..SINGLE_TABLE)、@DiscriminatorColumn、@DiscriminatorValue、@DiscriminatorFormula)
一.结构 You can map an entire class hierarchy to a single table. This table includes columns for all pr ...
- 冰冻三尺非一日之寒-mysql(orm/sqlalchemy)
第十二章 mysql ORM介绍 2.sqlalchemy基本使用 ORM介绍: orm英文全称object relational mapping,就是对象映射关系程序,简单来说我们类似pyt ...
- Hive Tutorial(上)(Hive 入门指导)
用户指导 Hive 指导 Hive指导 概念 Hive是什么 Hive不是什么 获得和开始 数据单元 类型系统 内置操作符和方法 语言性能 用法和例子(在<下>里面) 概念 Hive是什么 ...
- Programming Entity Framework 翻译(1)-目录
1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...
- kudu
Kudu White Paper http://www.cloudera.com/documentation/betas/kudu/0-5-0/topics/kudu_resources.html h ...
- DTrace to Troubleshoot Java Native Memory Problems
How to Use DTrace to Troubleshoot Java Native Memory Problems on Oracle Solaris 11 Hands-On Labs of ...
随机推荐
- 解决element-ui 中upload组件使用多个时无法绑定对应的元素
问题场景 我们在一个列表中分别都需要有upload组件的时候也就涉及到了多个upload同时存在: 因为一般可以在success回调中拿到上传成功的图片已经成功的response,多个也可以,这个没毛 ...
- React周末特训班
Document #react819_content a { text-decoration: none; color: #ef7b2e; border-bottom: 1px solid #ef7b ...
- mysql5.6 无法使用64odbc连接
win10 64位,mysql5.6 无法使用64 连接odbc,处理:装32位odbc, 使用C:\Windows\SysWOW64\odbcad32.exe 配置.
- Java探秘之基本数据类型和包装类(int,Integer)(一)
最近闲来无聊打算做一个博客网,没事记记笔记什么,可是网站不好做,需要点时间,就先写写笔记来练练手. 可是要写什么呢,太难的好像我也写不出来,万一写错了误导别人就不好了. 哈哈,不多说,直奔主题,要是写 ...
- spring框架-spring.xml配置文件
运行的时候会报错的,因为写到<bean>标签里面去了,肯定会报错的,要记得把注释删掉,就不会报错了,这样写注释是为了方便下次自己看. <?xml version="1.0& ...
- Win7 JBOSS的下载安装、环境变量配置以及部署
1. 下载安装 http://jbossas.jboss.org/downloads/ 我下载的是:JBoss AS7.1.1.Final 2. 解压安装包 D:\Java\jboss-as-7.1 ...
- 学会用requirejs,5分钟足矣
学会用requirejs,5分钟足矣 据说公司的项目较多的用到requirejs管理依赖,所以大熊同学挤出了5分钟休息时间学习了一下,现在分享一下.如果你想了解requirejs的实现原理,请绕道!如 ...
- 第三篇:RESTful介绍
在介绍restful之前先放一张从之前文章评论里看到的图,我觉得它把soap和rest之间的一些区别形容地非常形象. 在第一篇和第二篇中我们也介绍过,soap协议传递的报文要基于xml格式的soap消 ...
- (转)java中对集合对象list的几种循环访问总结
Java集合的Stack.Queue.Map的遍历 在集合操作中,常常离不开对集合的遍历,对集合遍历一般来说一个foreach就搞定了,但是,对于Stack.Queue.Map类型的遍历,还是有一 ...
- Objective-C AVPlayer播放视频的使用与封装
大致效果 不要介意.界面有点丑... 界面搭建 看下成员变量就知道我怎么搭建的了,这里我将video播放层的size作为参照量,对所有控件的size按照其video的size宽高进行比例缩放 @int ...