简体   繁体   中英

Avoid Comma Separated values in table column Oracle 11g

I am working on a Spring MVC based web application. 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.

  1. Emp_Personal_Detail
  2. Emp_Official_Detail
  3. Emp_Location_Detail
  4. Emp_Banking_Detail

Now, the twist here is in Emp_Official_Detail. There is column name Function/Wing and Assigned_Section .

Function_Wing is Master table containing, Administration, Finance, Human Resources, IT, Automotive, Area Stor etc.

Similarly, Assigned_Section is Master table containing values

Bonds, IDPC, Joint Venture, Equity, Audit, Taxes etc.

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 .

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.

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

Second Table for mapping Employee to Assigned Section: Structure will be simple 2 columns: 1. Employee_code 2. Assigned_section

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM