Database Reference
In-Depth Information
[
{"name": "ts", "type": "timestamp", "mode":
"required"},
{"name": "location", "type": "record", "fields": [
{"name": "zip", "type": "string"}
]},
{"name": "running", "type": "record", "mode":
"repeated", "fields": [
{"name": "name", "type": "string"},
{"name": "importance", "type": "record", "fields":
[
{"name": "level", "type": "integer"}
]},
{"name": "memory", "type": "record", "fields": [
{"name": "total", "type": "integer"},
]}
]}
]
The standard way to represent this data in a relational database would be
to use two separate tables and establish a foreign key relationship between
them.
CREATE TABLE PhoneLog (
record_id CHAR(64),
id CHAR(64),
ts TIMESTAMP,
location_zip CHAR(5),
PRIMARY KEY (record_id)
);
CREATE TABLE Application (
record_id CHAR(64),
position TINYINT UNSIGNED,
name VARCHAR(128),
importance_level INT,
memory_total INT,
PRIMARY KEY (record_id, position),
FOREIGN KEY (record_id) REFERENCES
Search WWH ::




Custom Search