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 ...
随机推荐
- 三、使用vscode在docker中debug
上篇博文中分享了如何用docker-compose搭建AspNetCore的开发环境,在开发过程中debug是必不可少的,如果你使用VS2017的话,右键就可以了,而作为跨平台的.net core开发 ...
- 关于MySQL的commit非规律性失败案例的深入分析
案例描述: 一个普通的事务提交,在应用里面会提示commit超时,失败. 一.理论知识 1.关于commit原理,事务提交过程 1.寻找修改的数据页: 1.如果该数据页在内存中,则直接是内存读: 2. ...
- 两个java项目,跨域访问时,浏览器不能正确解析数据问题
@Controller@RequestMapping(value = "api/item/cat")public class ApiItemCatController { @Aut ...
- js继承之Object.create()
通过 Object.create() 方法,使用一个指定的原型对象和一个额外的属性对象创建一个新对象.这是一个用于对象创建.继承和重用的强大的新接口.说直白点,就是一个新的对象可以继承一个对象的属性, ...
- PHP----SAPI
SAPI:Server Application Programming Interface 服务器端应用编程端口.它就是PHP与其它应用交互的接口,PHP脚本要执行有很多种方式,通过Web服务器,或者 ...
- 初涉算法——C++
一.sstream头文件运用 题目:输入数据的每行包括若干个(至少一个)以空格隔开的整数,输出每行中所有整数之和. #include<iostream> #include<cstri ...
- python之总体理解
作为脚本,python具备了弱类型语言的灵活性,便捷性.这在日常的开发使用中能够大幅度的减轻开发人员的编码负担,开发者也能够将精力集中在程序的逻辑管理和总体构架设计上.一般而言,随着经验的积累,开发人 ...
- iOS事件响应链(Responder Chain)
概述 在iOS中,视图的层级一般都是 父视图->添加各种子视图.这时候某个视图(子视图)上有个按钮,需要我们交互.但是有时候我们会发现无论如何都没有反应.这时候可能就是我们对iOS的事件传递响应 ...
- (转)硬盘分区备忘(主分区,扩展分区和逻辑分区)以及Linux硬盘分区工具parted 介绍
场景:最近在学习Linux的基础知识,不可避免的设计到Linux的磁盘分区,以前做过总结,但是那种总结就是复制别人的文章,总结完就不想看第二遍,所以很容易就遗忘了!清楚明白的理解分区后,我就可以在自己 ...
- 初学安卓开发随笔之 Menu、toast 用法、活动的四种启动模式 以及 一个方便的Base活动类使用方法
Toast toast 是安卓系统的一种非常棒的提醒方式 首先定义一个弹出Toast的触发点,比如可以是按钮之类 其中 Toast.LENGTH_SHORT是指显示时长 还有一个内置变量为Toast. ...