[英]Avoid Comma Separated values in table column Oracle 11g
I am working on a Spring MVC based web application. 我正在基于Spring MVC的Web应用程序上工作。 I am using Oracle 11g
and I need to normalize a table name "Employee"
contained 100 columns, currently, I broke down the same in four different tables. 我正在使用Oracle 11g
,我需要规范化包含100列的表名"Employee"
,目前,我在四个不同的表中分解了相同的表。
Now, the twist here is in Emp_Official_Detail. 现在,这里的问题在Emp_Official_Detail中。 There is column name Function/Wing
and Assigned_Section
. 列名称为Function/Wing
和Assigned_Section
。
Function_Wing
is Master table containing, Administration, Finance, Human Resources, IT, Automotive, Area Stor etc. Function_Wing
是主表,包含管理,财务,人力资源,IT,汽车,区域存储等。
Similarly, Assigned_Section
is Master table containing values 同样, Assigned_Section
是包含值的主表
Bonds, IDPC, Joint Venture, Equity, Audit, Taxes etc. 债券,IDPC,合资企业,股权,审计,税收等
For each employee, there will be one-to-many mapping for both the column. 对于每位员工,这两列都将具有一对多映射。 In a simple way, each employee is associated with multiple Function/Wing
and also at the same time, each employee is also associated with multiple Assigned_Section
. 通过简单的方式,每个员工都与多个Function/Wing
关联,并且同时,每个员工还与多个Assigned_Section
关联。
What I did for now, 我现在所做的
I just store the values by comma separation. 我只是用逗号分隔来存储值。
For example: 例如:
Emp_name: jones
Emp_code: 12321
Function/Wing: 1,2,3
Assigned_section:5,6
But I don't want to manage the values in such a manner. 但是我不想以这种方式来管理值。 In the future, I need to display the data as well as implement the download excel functionality, as I experienced, that comma separated value degrades the query performance. 将来,我需要显示数据并实现下载excel功能,正如我所经历的那样,逗号分隔的值会降低查询性能。
Right now I am in the development phase and I have time to finalize the things, so kindly suggest me, what is the best approach or best structure to follow, So it will be easily fetched efficiently. 现在,我正处于开发阶段,我有时间完成这些工作,因此建议我遵循的最佳方法或最佳结构是什么,因此很容易高效地获取它。
You need two more tables to resolve this. 您还需要两个表来解决此问题。
First Table for mapping Employee to Function/Wing mapping: Structure will be simple 2 columns: 1. Employee_code 2. Function/Wing 用于将Employee映射到Function / Wing映射的第一张表:结构将是简单的两列:1. Employee_code 2. Function / Wing
Second Table for mapping Employee to Assigned Section: Structure will be simple 2 columns: 1. Employee_code 2. Assigned_section 用于将Employee映射到Assigned Section的第二张表:结构将是简单的两列:1. Employee_code 2. Assigned_section
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.