Are spare tables and fields causing confusion and inefficiency in your organization’s database management? Are they causing problems during the ETL process? The presence of poorly designed spare tables often complicates operations, leading to data inconsistency and querying difficulties. Moreover, unconventional data storage practices, such as storing multiple values within single columns using semicolon separators, further exacerbate the problem. Addressing these challenges requires a comprehensive approach, including establishing clear data management policies, enforcing data integrity standards, and possibly restructuring the database to eliminate unnecessary components.
Scenario Analysis: SpareTable
Let’s consider you have spare table in Production called SpareTable.
The structure of SpareTable was defined to store 10 values, each value is separated by semicolon- i.e. 9 Semicolons, and the table structure with sample data is given below, where the last two records have more than nine semicolons unfortunately.

Here are the records that contain more than nine semicolons:

If your database have more than 9 semicolon, that’s unusual but that might exist because of poor database design. In the example above, the last two records have 10 semicolon, and will create significant issues in the data warehouse.
Reason why there exists more than 9 Semicolons
This is due to the fact that the user can enter a semicolon(;) within a single field, which causes problems in the data warehouse.
This discrepancy can lead to unintended parsing errors and inaccurate data extraction, undermining the database’s integrity and reliability.
Why is it problematic?
- Custom Handling: Managing each table differently is against standard practices, leading to inconsistencies and making database management more complex.
- Limited Flexibility: Custom approaches make it difficult to adjust the database to changing needs, hindering its flexibility and scalability.
- Maintenance Complexity: Dealing with various customizations increases workload, especially when handling special data fields, making routine tasks more error-prone and time-consuming.
Temporary Solution: How to handle this situation?
- Modifying data extraction rule at Source Level: Adjust data extraction and processing routines to accommodate irregularities in the data structure, such as using arrays for extraction.
For example, if your ERP system uses a PROGRESS database, you might first get table fields as strings using some ETL Tools (e.g. Talend for Data Integration). But if there’s a problem with semicolons, you might take the values directly from the source, treating them like arrays instead of strings. This makes sure each field is taken out one by one in source level of ETL process. While it adds extra work by breaking general rules, it’s faster. - Using STRING_SPLIT() in a Custom Way: Apply string split function in Postgres i.e. STRING_SPLIT() – to specific tables.
Long Lasting Solution: How to Handle this Situation?
To mitigate the challenges posed by semicolon-delimited fields, organizations can consider the following strategies.
- Normalization: Normalize the database structure to eliminate the need for semicolon-delimited fields (in transactional level), ensuring data integrity and simplifying maintenance. The normalization process for SpareTable is described in the next step.
- Validation Rules: Enforce validation rules to prevent users from inputting semicolons within fields, reducing the risk of parsing errors and data inconsistencies.
Incorrect Data Input | Validation Rule Enforcement |
---|---|
firstname;lastname | Warning: Do not use semicolons in CustomerName field. |
streetaddress;city | Prompt: Please enter data without semicolons. |
Normalizing “Production”.”SpareTable”:
The process of Normalization for SpareTable is given below:
e.g. Before Normalization, the values were stored in a single column but with normalization, the they are stored in separate columns, and the normalizaiton
Before Normalization | After Normalization |
---|---|
Table: SpareTable ID | SpareField | Table: personalinformation id | firstname| lastname | department | position | gender | additionalinformation Table: address id | streetaddress | city | state | zip | country |
The id (PK) of address table is FK for personalinformation table. Now, they should look like following:
Table : personalInformation

Table: address

Conclusion
In conclusion, addressing challenges associated with poorly designed spare tables and semicolon-delimited fields is crucial for enhancing database management efficiency and ensuring data integrity. By implementing strategies such as normalization, and validation rules enforcement, organizations can streamline operations, simplify maintenance, and pave the way for long-term scalability.
___________________________________________________________________________________
Used Queries:
Create and Insert Query for SpareTable before Normalization:
-- Create a sample table
CREATE TABLE "Production"."SpareTable" (
"ID" INT,
"SpareField" VARCHAR(255)
);
-- Insert records with varying numbers of semicolon-delimited fields
INSERT INTO "Production"."SpareTable" ("ID", "SpareField") VALUES
(1, 'John;Doe;123 Main St;New York;NY;10001;USA;Engineering;Senior;Male'),
(2, 'Alice;Smith;456 Oak St;San Francisco;CA;94105;USA;Marketing;Manager;Female'),
(3, 'Bob;Johnson;789 Pine St;Los Angeles;CA;90012;USA;Finance;Analyst;Male'),
(4, 'Eva;Miller;101 Pine Ave;Chicago;IL;60601;USA;Sales;Representative;Female'),
(5, 'Daniel;White;222 Elm St;Austin;TX;73301;USA;IT;Developer;Male'),
(6, 'Sophia;Davis;333 Maple St;Seattle;WA;98101;USA;HR;Coordinator;Female'),
(7, 'Grace;Anderson;789 Willow St;Denver;CO;80202;USA;IT;Manager;Female'),
(8, 'Michael;Smith;444 Birch St;Miami;FL;33101;USA;Sales;Representative;Male'),
(9, 'Olivia;Davis;555 Cedar St;Phoenix;AZ;85001;USA;Finance;Analyst;Female'),
(10, 'Liam;Jones;666 Oak St;Portland;OR;97201;USA;Engineering;Senior;Male'),
(11, 'Emma;Johnson;777 Pine St;Dallas;TX;75201;USA;Marketing;Coordinator;Female;SEO'),
(12, 'Noah;Wilson;888 Maple St;Houston;TX;77001;USA;IT;Analyst;Male;Java');
Create and Insert Query after Normalization:
-- Create PersonalInformation table
CREATE TABLE PersonalInformation (
ID INT PRIMARY KEY,
FirstName VARCHAR(255),
LastName VARCHAR(255),
Department VARCHAR(255),
Position VARCHAR(255),
Gender VARCHAR(10),
AdditionalInformation VARCHAR(255)
);
-- Create Address table
CREATE TABLE Address (
ID INT PRIMARY KEY,
StreetAddress VARCHAR(255),
City VARCHAR(255),
State VARCHAR(255),
ZIP VARCHAR(10),
Country VARCHAR(255),
FOREIGN KEY (ID) REFERENCES PersonalInformation(ID)
);
-- Insert data into PersonalInformation table
INSERT INTO PersonalInformation (ID, FirstName, LastName, Department, Position, Gender, AdditionalInformation)
VALUES
(1, 'John', 'Doe', 'Engineering', 'Senior', 'Male', NULL),
(2, 'Alice', 'Smith', 'Marketing', 'Manager', 'Female', NULL),
(3, 'Bob', 'Johnson', 'Finance', 'Analyst', 'Male', NULL),
(4, 'Eva', 'Miller', 'Sales', 'Representative', 'Female', NULL),
(5, 'Daniel', 'White', 'IT', 'Developer', 'Male', NULL),
(6, 'Sophia', 'Davis', 'HR', 'Coordinator', 'Female', NULL),
(7, 'Grace', 'Anderson', 'IT', 'Manager', 'Female', NULL),
(8, 'Michael', 'Smith', 'Sales', 'Representative', 'Male', NULL),
(9, 'Olivia', 'Davis', 'Finance', 'Analyst', 'Female', NULL),
(10, 'Liam', 'Jones', 'Engineering', 'Senior', 'Male', NULL),
(11, 'Emma', 'Johnson', 'Marketing', 'Coordinator', 'Female', 'SEO'),
(12, 'Noah', 'Wilson', 'IT', 'Analyst', 'Male', 'Java');
-- Insert data into Address table
INSERT INTO Address (ID, StreetAddress, City, State, ZIP, Country)
VALUES
(1, '123 Main St', 'New York', 'NY', '10001', 'USA'),
(2, '456 Oak St', 'San Francisco', 'CA', '94105', 'USA'),
(3, '789 Pine St', 'Los Angeles', 'CA', '90012', 'USA'),
(4, '101 Pine Ave', 'Chicago', 'IL', '60601', 'USA'),
(5, '222 Elm St', 'Austin', 'TX', '73301', 'USA'),
(6, '333 Maple St', 'Seattle', 'WA', '98101', 'USA'),
(7, '789 Willow St', 'Denver', 'CO', '80202', 'USA'),
(8, '444 Birch St', 'Miami', 'FL', '33101', 'USA'),
(9, '555 Cedar St', 'Phoenix', 'AZ', '85001', 'USA'),
(10, '666 Oak St', 'Portland', 'OR', '97201', 'USA'),
(11, '777 Pine St', 'Dallas', 'TX', '75201', 'USA'),
(12, '888 Maple St', 'Houston', 'TX', '77001', 'USA');
Discover more from Data Engineer Journey
Subscribe to get the latest posts sent to your email.