Answer the question
In order to leave comments, you need to log in
How to store the distance to the stars?
Good day!
Now I am making a database of stars, it stores both relatively close to us stars and distant ones (from the Sun and much further).
In all major sources, the distance is indicated in light years/hours/minutes.
For example, from the Earth to the Sun ~ 8 light minutes. And up to UDFj 13 billion light years.
How and in what form should I store such data in an SQL database, what type should I use?
Answer the question
In order to leave comments, you need to log in
Store 2 values:
1) A float - distance
2) B integer - power of 10
result A * (10 ^B)
To Sun (8; 0), to UDFj (13, 9)
float for precision
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question