Avatar of rmmarsh
rmmarshFlag for United States of America

asked on 

Need some design help with SQLite...

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)"];

Open in new window


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)" ];

Open in new window


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?
Databases.NET ProgrammingC#

Avatar of undefined
Last Comment
rmmarsh
ASKER CERTIFIED SOLUTION
Avatar of Anuradha Goli
Anuradha Goli
Flag of Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of rmmarsh
rmmarsh
Flag of United States of America image

ASKER

Thank you... I appreciate it!
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo