I have 3 tables:
Store (Store_Id, Store_Name, Store_Location)
Bike(Store_Id, Bike_Id,Bike_Model, Bike_Price)
Parts(Store_Id, Bike_Id, Part_Id, Part_Description, Part_Price)
The Store is related to the Bike using Store_Id, the Bike parts is related to the Bike using bike_id. Each bike is assembled with different parts.
I want to create report that displays all the stores, bikes, and the all the bike parts used on a bike that has "Pink streamers in the description.
I honestly don't know where to start.
Please take in consideration that this database can contains thousands of bikes.
As others have said, this is a very basic question and reading some of the basics can give you the help you need.
To answer the question: in the Database Expert you will see your 3 tables. Link them together by dragging and dropping the related fields on each other. ie. link Store.Store_ID --> Bike.Store_ID --> and Bike.Bike_ID --> Parts.Bike_ID.
In the record selection formula set the description value: {parts.part_description} = "Pink Streamers".
This will give you all stores and the bikes in those stores that have "Pink Streamers"
Related
I have two tables containing a list of company names. The first one would be the index table therefore the value inside would be clean and the format is consistent. The second table contains user-input company information and therefore there might be typos and format inconsistencies.
The first one (the index table) looks similar to this:
company_name | industry
Apple Inc Technology
Amazon Inc Retail
Kraft Heinz Food Processing
New York Life Insurance Company Insurance
Tesla Inc Tesla
Walmart Inc Retail
The second table (user input table) looks similar to this
company_name
Apple
Apple Inc.
Amazon, Inc
Kraft
New York Life
Tsla
Walmart
Notice that the second table does not have the industry column since the main goal would be to add the industry column to the second table, but since there is no key we can't simply join the two tables.
I think the first step would be to compare the similarity between the company_name and if it is similar enough we can just assume it is the same.
I have done some research and I think we would need to use Levenshtein Distance. Honestly, I am not very familiar with that method, but from my limited understanding, I wonder if it is applicable for inputs containing multiple words (e.g New York Life Insurance Company) or it is just effective for one-word input (e.g Apple).
Any suggestions or guidance would be greatly appreciated.
I need to implement an API which can fetch the medicine detail from UPC bar code. All the solutions i got on web are providing ways to read the bar code but I did not found any such API which could get me the product information like medicine Name, Manufacturer, Dosage, Expiry, Batch No etc form the bar code.
Any suggestion would be appreciated.
Assuming you're operating in the US, usually the UPC is actually a shortened version of the NDC, usually with the "extraneous" 0's left out. You need to convert to NDC and then look that data up against a drug database, like the FDA database. Usually however, pharmacies will buy a database from one of the drug database suppliers (e.g. Etreby or Elsevier) because those are curated and have a lot more detail and are usually easier to work with for the sorts of queries a pharmacy might want to make.
Edit: Per my comment below, it looks like you can query the FDA database via UPC without converting to NDC first.
This is a question about model design for SQL or SQLite.
Suppose you have some card game which has many reusable cards and the players make decks out of those card (e.g. MtG)
Naturally you do not want to make new instances of the cards for every deck that a user might create. That would have a lot of redundancy.
Thus there should be a "master" card (with all of its associated info).
My question is then, how to best integrate the cards (and quantity there of) in a given deck?
(I am not actually making this database, it just highlights the design of having a user having any number collections of multiple items in various quantities from some general stock).
Have three tables: One table has the data on the cards (name, cost, etc.). Another table has decks (deck name, creator, etc.). And another table has the cards in the deck (deck_cards) (linking card_id to deck_id with quantity).
EDIT: addendum: This is the same set up (and rationale) as the classic go-to example used in all database design primers: products, orders, and order-line-items. The only piece missing is "customers" (which could be added if you wanted to link decks to players or deck-builders).
I would imagine something like:
Cards - Table containing card details
Card_ID Card_Name Card_Dmg Card_Attribute Card_Health
123 Fire Mage 20 Fire 100
345 Water Man 6 Water 200
037 Earth Dwarf 10 Earth 150
Players - Table containing Player details
Player_ID Player_ForeName Player_Surname
1 Fred Smith
Player_Cards - Table detailing the players deck, with a new row for each card they own, e.g:
Player_ID Card_ID
1 123
1 345
1 037
I'm a bit confused with Sqlite, Core Data, NSUserDefaultsand PropertyList. I know what is what, but not a very clear idea of about where to appropriately use them.
I know that there are lots of tutorials, but I'm good at learning through situation based understanding. So kindly do help me to understand this in the situation that I'm facing right now and to make use of the available options wisely.
I'm working on an ECommerce iOS (native) application, where I'm highly dependent on API's for data display. Now I'm in need of recording user's review for a product and send it over through an API.
ie. I have three components, rating title, rating value(for that title) and another rating title ID. I'm defining with an example, I need to store multiple rows with details,
Components Data to be stored
**Title** - Quality | Value | Price
| |
**Rating** - 2 | 3 | 1
| |
**TitleID** - 10 | 11 | 12
Like this, there will be so many entries, i.e, the number of components differs for various users, for some users, there might be more than three components, which must be saved & send through an API. So how should I save these data? which is the RIGHT way to save these data temporarily?
If I understand you correctly, as vaibhav implied your question seems pretty general and probably relates more to structuring your data to fit your requirements than to technical aspects of the iOS / CoreData environment. In that vein, I’ll offer a few thoughts I’d have in structuring a data structure for quality ratings per your description.
If your ratings will always be for the three categories you show, i.e. Quality, Value and Price, I wouldn’t over-complicate things; I’d just use three properties in a rating record to hold the values that a user assigns in his/her rating of a product (just showing selected attributes and relationships in all following lists):
Product
name
Rating
ratedProduct (many to one)
qualityRating Int
valueRating Int
priceRating Int
Done this way you’d need to associate the values with their types in code for the APIs, such as (where item is a retrieved rating record):
display(product: item.ratedProduct.name, quality: item.qualityRating, value: item.valueRating, price: item.priceRating).
On the other hand, you may be describing a more generic approach that would allow for ratings categories that vary more frequently, or perhaps vary among products. This could apply where, for example, ratings include how well things fit for clothing but not for other products like books. In that case, you’d need a more complicated structure where a product could have a variable number of ratings of different types, so you’d need another layer of entities that let you create an arbitrary number of rating records that applied to a product.
Here you'd create a separate rating record for each rating that a user assigned to a product.
The simplest form of that structure would be like the following:
Product
name String
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
Then you’d have to have a bit more structure where you'd list the product and then access the ratings with a loop that cycled through the set of all of the ratings linked to the product record somewhat like this (where item is a retrieved UserEvaluation):
displayTitle(product: item.ratedProduct.name)
for rating in item.productRating {
displayRating(ratingTitle: item.productRating.ratingType.title, ratingValue: item.productRating.value)
}
You'd probably want to combine these into a method that takes the name and an array of ratings.
To keep track of things, you’d also probably want to create another entity that defined product classes and specified what specialized ratings applied to each class (like fit for clothing and mileage for cars). By default, you also may want to allow for a few generic rating types that apply to all products (like the quality and price ratings you show). For this approach, the full structure would look like this:
Product Category
title
ratingType (many to many)
Product
productType (many to one)
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
With this structure, once a product is assigned a productType, the application would know what ratings to ask for in the UI.
You could try building more complicated rating records with all of the types that apply to a product category, but that would get very messy if the applicable categories vary over time. You could also create a "custom" rating type that let a user specify a title and input a rating, in which case you'd need a text field in the rating record that only applies if the ratingType is "custom".
I hope this helps…
Here is my dilemma, I am building a POS system for a pretty large retailer, they have different products which have different attributes (size, color, etc...).
When they receive the merchandise from the supplier they want to do their own labeling with their own UPC Bar Codes but they also want to differentiate between the different sizes using the code on the article.
Say they received Brand A shirts with 4 sizes S,M,L,XL then they should have different bar codes for each size.
So I thought of having a base code for the article and then concatenating numbers depending on the attributes to have different codes? and if no attributes are available just add 0s
I am storing the sizes and colors as attributes in the database as an (Entity-Attribute-Value). Is their a better way other than having to start concatenating numbers from the attributes to come up with the full code?
Thanks for your help!
edit-------------------------------------------------------
I am making the example a bit clearer
so the base code for the shirts is: 9 123456
Then for Color blue is: 789
and then for size S: 012
so the full code is 9 123456 789012
for another article that doesn't have size or color or actually any attribute
the base code would be 9 654321
plus 000000 for the attributes part
this is just for simplicity sake as I can use only one digit per attribute.
The other issue is when linking to the OrderDetails table I need to reference all the attributes to know that the customer actually bought Size S in Blue
One possible option is to create a table that stores the bar code as the key. Then have an attribute for the size and the color.
Actually #jzd your answer is pretty close but I would like to keep the attributes as key value pair.
The idea is to use and an attribute set and have a bar code associated with each set. here is a rough schema
AttributeSet Table:
AttributeSetId
ProductId
AttributeSetName
BarCode
AttributeUse Table:
AttributeSetId
AttributeId
AttributeSetInstance Table:
AttributeSetId
AttributeId
AttributeValueId
if you forget the barcode for a minute...
do you have a database to track this inventory?
are the items stored discretely in this database?
if so, then just add a unique number to the item, called the UPC vale - i recommend not trying to make an intelligent key s\as you are describing