Hypertable sql

来源:互联网 发布:剑桥国际英语 知乎 编辑:程序博客网 时间:2024/06/05 10:05

First, create a new namespace called “Test”:

CREATE NAMESPACE Test;

and make it the current namespace:

USE Test;

 

Now, let’s create a new table within the current namespace:

CREATE TABLE fruits (color, energy, protein, vitamins);

and insert some data:

INSERT INTO fruits VALUES ("apple", "color", "red"),
("apple", "energy", "207KJ"),
("apple", "protein", "0.4g"),
("apple", "vitamins:C", "15mg"),
("apple", "vitamins:B1", "0.02mg");

INSERT INTO fruits VALUES ("banana", "color", "yellow"),
("banana", "energy", "375KJ"),
("banana", "protein", "1.2g"),
("banana", "vitamins:C", "10mg"),
("banana", "vitamins:B1", "0.04mg");

 

Finally, issue some queries, for example:

SELECT CELLS * FROM fruits;
SELECT CELLS * FROM fruits WHERE ROW=”banana”;
SELECT CELLS vitamins FROM fruits WHERE ROW=”apple”;
SELECT CELLS vitamins:B1 FROM fruits;
0 0
原创粉丝点击