Answer the question
In order to leave comments, you need to log in
What is the best way to organize a SQLite database of orders with a quick search by phone numbers?
Need a database to store orders.
Each order has many different parameters and they are stored in one table. Previously, there was only one contact phone number, and it just lay in a separate column. Now it is required to make it possible to attach an unlimited number of contact numbers to the order (and in the future, perhaps, other types of contact data). And the user should be able to quickly make a selection by the number of all orders. What is the best way to do this?
And yet, now phones are normalized and stored as TEXT, does it make sense to store them as INTEGER or CHAR to increase speed?
Answer the question
In order to leave comments, you need to log in
It is generally accepted to store a phone number in text form, there are several reasons:
1) The phone number can start with zero or a pair of zeros at once, which actually makes it impossible to use the integer type
2) The length of the number can be more than 50 characters
Therefore, for universal database design, for SQLite you can select Text.
And what caused the choice of sqlite?
It is slow and blocks the entire database for each request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question