troubleshooting Question

Need some design help with SQLite...

Avatar of rmmarsh
rmmarshFlag for United States of America asked on
Databases.NET ProgrammingC#
2 Comments1 Solution533 ViewsLast Modified:
I'm trying to create a SQLite database consisting of two tables: Customer and Order.   This is what I have so far for the Customer table:

        [db executeUpdate:@"CREATE TABLE IF NOT EXISTS CustData ("
         "BUS_NAME TEXT PRIMARY KEY NOT NULL, "
         "EMAIL TEXT, "
         "PHONE TEXT, "
         "SHOP_NAME TEXT, "
         "SHOP_ADDR1 TEXT, "
         "SHOP_ADDR2 TEXT, "
         "SHOP_CITY_STATE TEXT, "
         "SHOP_ZIP TEXT, "
         "SHIP_NAME TEXT, "
         "SHIP_ADDR1 TEXT, "
         "SHIP_ADDR2 TEXT, "
         "SHIP_CITY_STATE TEXT, "
         "SHIP_ZIP TEXT, "
         "NOTES TEXT)"];

This what I have for my Order table:

        [db executeUpdate:@"CREATE TABLE Orders ("
         "CUST_ID TEXT REFERENCES CustData, "
         "ORDER_NBR TEXT, "
         "SALES_NAME TEXT, "
         "CREDIT_CARD TEXT, "
         "EXP_DATE TEXT, "
         "CID TEXT, "
         "NOTES TEXT, "
         "PCS INTEGER, "
         "PATTERN TEXT, "
         "STYLE_NAME TEXT, "
         "PRICE DECIMAL)" ];

My questions are:
Is the "references" statement correct?  I want to have each order reference the key in the Customer table
PCS, pattern, style_name and PRICE will occur many times for each "order".  Is this the correct way to define them in the Order table, or is there a better way?
ASKER CERTIFIED SOLUTION
Anuradha Goli
Anuradha Goli (anuradhay)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros