How do others know what is delivery address and invoice address if they are in the same table?
4
votes
5
answers
2576
views
When I searched around, the recommended way is to use the invoice address and delivery address in the same table and use a field "type" to show what it is. For example
Addresses(Company, address, city, type)
Type = 1: The address is a delivery address
Type = 2: The address is a invoice address
Type = 3: The address both delivery address and invoce address (same address)
If someone does not look at my code that uses the database, they can not know what Type 2 is. Is it delivery, invoice or both? Do you usually clarify this and how? For example, if someone wants to search the database (outside my code that calls the database) for all billing addresses, they do not know if they should use type 1, 2 or 3 to get all invoice addresses from a database client.
Compared to if you had two tables, then the name of the table says what it is and whoever can easily pick out all the invoice addresses.
Delivery(Company, address, city)
Invoice(Company, address, city)
Asked by Xtreme
(141 rep)
Jan 31, 2021, 04:24 PM
Last activity: Feb 3, 2021, 03:39 AM
Last activity: Feb 3, 2021, 03:39 AM