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的更多相关文章

  1. Database: key

    super-key: Any key that has more columns than necessary to uniquely identify each row in the table i ...

  2. [转]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 ...

  3. SAP CRM One order里user status和system status的mapping逻辑

    Below example show: How the mapping relationship between User status and System status maintained in ...

  4. 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 ...

  5. 冰冻三尺非一日之寒-mysql(orm/sqlalchemy)

    第十二章  mysql ORM介绍    2.sqlalchemy基本使用 ORM介绍: orm英文全称object relational mapping,就是对象映射关系程序,简单来说我们类似pyt ...

  6. Hive Tutorial(上)(Hive 入门指导)

    用户指导 Hive 指导 Hive指导 概念 Hive是什么 Hive不是什么 获得和开始 数据单元 类型系统 内置操作符和方法 语言性能 用法和例子(在<下>里面) 概念 Hive是什么 ...

  7. Programming Entity Framework 翻译(1)-目录

    1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...

  8. kudu

    Kudu White Paper http://www.cloudera.com/documentation/betas/kudu/0-5-0/topics/kudu_resources.html h ...

  9. 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 ...

随机推荐

  1. mysql常见的优化方法

    1.选取适当的字段属性.例如,在定义邮政编码这个字段时,如果将其设置为CHAR(255),显然给数据库增加了不必要的空间,甚至使用VARCHAR这种类型也是多余的,因为CHAR(6)就可以很好的完成任 ...

  2. Java电器商场小系统--简单的java逻辑

    //商场类public class Goods { int no; //编号 String name; //商品名称 double price; //商品价格 int number; //商品数量 / ...

  3. Java 并发编程内部分享PPT分享

    .NET程序员转向JAVA领域,必备技术首当其冲就是JAVA Concurrency 并发编程. 最近系统性的学习了 Doug Lea <JAVA并发编程实战>一书.这书很有嚼劲,进入JA ...

  4. POJ 3126 math(BFS)

    Prime Path Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21581   Accepted: 11986 Desc ...

  5. Iterator、for..of,for...in和自定义遍历器**

    Iterator.for..of,for...in和自定义遍历器 Iterator: var arr = [1,2,3,4,5]; var ite = arr[Symbol.iterator](); ...

  6. nodejs-ORM 操作数据库中间件waterline的使用

    waterline和Sails.js同一团队开发,支持几乎所有的主流数据库,是nodejs下一款非常强大的orm,可以显著提升开发效率 一.waterline支持的数据库 二.waterline的配置 ...

  7. 【一步一步】Spring 源码环境搭建

    平时项目中基本上都会用到spring,但是源码还没有深入的了解过.趁这段时间稍微空闲点,开始研究下spring 源码.下面是spring 源码的环境搭建. 主要分为如下步骤: ①安装jdk,gradl ...

  8. Webi Report 展示 图片链接 (Image Link)

    最近由于项目需求,在生成的Webi Report中需要增加一列展示相关数据系统的图片链接,要求用户可以通过点击图片链接展示图片. 方法如下: 1,首先找到系统中图片,查看随机一张图片的属性,找到图片的 ...

  9. BestCoder Round #92 (hdu_6015 6016)

    比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long l ...

  10. MD5加密Demo

    package com.util; import java.security.MessageDigest; public class MD5 { public final static String ...