Re: [sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-04-07 Thread 邱朗
Hi, Thanks for answering my question. But no matter whether it is "a problem in definition" or other reasons, it already happened in my system (And that was why I asked the question in the first place). And if we just ignore my particular question, I think it is not uncommon that many to many

Re: [sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-04-05 Thread Richard Damon
On 3/31/17 6:08 AM, 邱朗 wrote: Say my mobile app has a customer table, a product table, and an order table to record who buys what, the order table basically has 2 foreign keys, customer_id & product_id. Now I got the order information first, within in it I can't find the customer information

Re: [sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-04-05 Thread petern
Qiulang. I am curious about this requirement. Is there an example commerce site in the real world where having a one to one match in a master customer login table to all real customers is vital to the mission? What sort of business would have that? Even banks do not have such surety about

[sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-04-04 Thread 邱朗
"Another option is to create an "Unknown" customer, and link any new orders to it. You can easily change that parent-id on the order later."This solution seems not work (especially in my case) because it is easy to have more than one unknown customer. Then I can't decide who orders what later.

Re: [sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-04-02 Thread Quan Yong Zhai
对于这样的问题SQLite也没有特别的解决方案。你说的方法几乎就是“标准”的做法,先把customer_id 设置为null, 然后插入该订单,( 这样就不会引起外部键检查失败), 当获取该订单准确的customer_id后,再把它更新。 App的逻辑应考虑到这一点,所有customer_id 为null的订单都是不完整的,相当于草稿。 Zhai Sent from Mail for Windows 10 From: 邱朗

Re: [sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-03-31 Thread R Smith
On 2017/03/31 12:08 PM, 邱朗 wrote: Say my mobile app has a customer table, a product table, and an order table to record who buys what, the order table basically has 2 foreign keys, customer_id & product_id. Now I got the order information first, within in it I can't find the customer

[sqlite] If I got many to many relationship data first, how do I insert them to my table?

2017-03-31 Thread 邱朗
Say my mobile app has a customer table, a product table, and an order table to record who buys what, the order table basically has 2 foreign keys, customer_id & product_id. Now I got the order information first, within in it I can't find the customer information in my local sqlite table. As it