Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3333754
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:49:52+00:00 2026-05-17T23:49:52+00:00

I design the tables as below for the system which looks like a package

  • 0

I design the tables as below for the system
which looks like a package delivering system.

For example, after user received the package, postman should record in system,
and the state(history table) is “delivered”,and operator is this postman,
the current state(state table) is of course “delivered”

history table:
+---------------+--------------------------+
|   Field       |        Desc              |
+---------------+--------------------------+
|    id         |    PRIMARY KEY           |
+---------------+--------------------------+
|    package_id |    package_tacking_id    |
+---------------+--------------------------+
|    state      |     package_state        |  
+---------------+--------------------------+      
|    operators  |    operators             |
+---------------+--------------------------+
|    create_time|    create_time           |
+---------------+--------------------------+   

state table:
+---------------+--------------------------+
|   Field       |        Desc              |
+---------------+--------------------------+
|    id         |    PRIMARY KEY           |
+---------------+--------------------------+ 
|   package_id  |    package_tacking_id    |
+---------------+--------------------------+
|    state      |    latest_package_state  |
+---------------+--------------------------+  

Above is just the basic information to record, some other information(
like invoice, destination,…) should be recorded as well.
But there are different service types like s1 and s2, for s1 it is not needed
to record invoice but s1 need, and maybe s1 need some other information to record
(like the tel of end user).

After all, at delivering way stations there are additional information to record,
and for different service type the information type is different.

My questions:

  1. For different service type, shall I need to declare different tables(option A) or just
    one big table which can record all information for all types(option B)?
  2. If option A, since the basic information above is MUST, how
    can prevent from declaring there duplicate fields in different tables?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:49:53+00:00Added an answer on May 17, 2026 at 11:49 pm

    I have no completed answer for your issue, but you may try inheritance pattern in table design.

    Service Table(service) : used to put common or not-null columns in all kinds of services.
    sv_id - internal key(PK)
    sv_data_1, sv_data_2, ...
    
    Service 1 Table : dedicated attributes to service 1 and 'inherited from service'.
    sv1_id - internal key(PK) and foreign key to service(sv_id)
    sv1_data_1, sv1_data_2, ...
    

    And so on to other dedicated service table…

    1. For convenience(and performance), adding a ‘sv_type’ column to represent the exact ‘sub-type table’ of servcie if you need to list all kinds of services.
    2. Otherwise, just using ‘inner join’ to get the specific type of service.

    Although we need to use ‘join’ to get all attributes of a specific type of service, but the schema showed would construct the ‘null-free’ solution for your issue.

    If you care about the performance issue, there is one positive thing: joining tables for a specific type of service is accomplished with two primary keys.

    More about performance, you can create cached tables with joined base tables when you need speedier query and don’t worry about null-error and type-error issue of services.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MS SQL Server 2005. What's the best schema for a Wiki-like system?
I have a system I am trying to design that will retrieve information from
I've got panels containing tables to organize textboxes/labels, and I'd like to center them,
I'm designing a RESTful Web app that will provide an authentication system for several
This is a new question which arose out of this question Due to answers,
I have a question about GUI design, specifically with Java Swing and creating clean
Based on the information I have provided below, can you give me your opinion
We have two systems where system A sends data to system B. It is
I'm working on a database design for groups hierarchy used as the foundation of
I am trying to design a data warehouse for a licensing vendor, who sells

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.