What are the lengths of Location Coordinates, latitude and longitude? [closed]

If the latitude coordinate is reported as -6.3572375290155 or -63.572375290155 in decimal degrees then you could round-off and store up to 6 decimal places for 10 cm (or 0.1 meters) precision. If the coordinate reference system (CRS) is not EPSG:4326 (e.g., EPSG:3857) then the x and y values measure a distance in meters from the … Read more

Sql – Indirect Foreign Key

You should always enforce referential integrity by using “normal” FOREIGN KEYs. In a nutshell, FOREIGN KEYs have the following advantages: They are already implemented within the DBMS. They are declarative, self-documenting and “obvious”. They cannot be bypassed (unless explicitly disabled or dropped). They are correct. They are fast. They support cascading referential actions (such as … Read more

Same data from different entities in Database – Best Practice – Phone numbers example

In most cases . . . “Staff” always describes people. Some customers are people. Some customers are businesses (organizations). “Suppliers” are usually (always?) organizations. Staff can also be customers. Suppliers can also be customers. There are serious problems with having separate tables of staff phone numbers, supplier phone numbers, and customer phone numbers. Staff can … Read more

designing database to hold different metadata information

This is called the Observation Pattern. Three objects, for the example Book Title=”Gone with the Wind” Author=”Margaret Mitchell” ISBN = ‘978-1416548898’ Cat Name=”Phoebe” Color=”Gray” TailLength = 9 ‘inch’ Beer Bottle Volume = 500 ‘ml’ Color=”Green” This is how tables may look like: Entity EntityID Name Description 1 ‘Book’ ‘To read’ 2 ‘Cat’ ‘Fury cat’ 3 … Read more

Database design – articles, blog posts, photos, stories

Here’s one way to implement supertype/subtype tables for your app. First, the supertype table. It contains all the columns common to all subtypes. CREATE TABLE publications ( pub_id INTEGER NOT NULL PRIMARY KEY, pub_type CHAR(1) CHECK (pub_type IN (‘A’, ‘B’, ‘P’, ‘S’)), pub_url VARCHAR(64) NOT NULL UNIQUE, CONSTRAINT publications_superkey UNIQUE (pub_id, pub_type) ); Next, a … Read more