No experience in database design. I have a following situation:
A table with 5 entries.
<DeviceIdentificationstr, data1, data2, data3.... data 5>
A table can have more than one device information.
I have designed something like this:
create table mytable (
sNo integer PRIMARY KEY,
DeviceIdentificationStr TEXT,
data1 integer,
data2 TEXT, ....)
Consider the following Scenario:
Record 1: 1, "Device1", "data1", 20, "data2", "data3"....
Record 2: 2, "Device2", "data1", 120, "data2", "data3"....
Record 3: 3, "Device2", "data1", 220, "data2", "data3"....
Record 4: 4, "Device1", "data1", 230, "data2", "data3"....
Here Device1 and Device2 are repeated all the time.
Are there any alternative way to design a table? Or is this the only way to go?
Also, i need to query something like: :Get all records of “Device1”.
You can perform so called normalization: create another table
devices:Change first table to be:
Now, you can use joins to get desired information, like this: