在SAP HANA Express Edition裡建立資料庫表
使用命令列訪問hdbsql:
# hdbsql -u SYSTEM -d SYSTEMDB -i 90
輸入SYSTEM使用者的密碼。
在預設的HXE database tenant上啟用document store:
ALTER DATABASE HXE ADD 'docstore';
使用下面的命令列建立一個document store collection:
CREATE COLLECTION food_collection;
注:hqlsql主要是用於Administration型別的工作使用,開發過程中最好還是用sqlpad等工具連線SAP HANA express.
往該document store裡插入資料:
INSERT INTO food_collection VALUES('{ "name" : "Kiwi", "group" : "Fruits", "subgroup" : "Tropical fruits", "nutrients" : { "Carbohydrate" : 20945.0, "Energy" : 176.0, "Fat" : 1955.0, "Fiber" : 1925.0, "Proteins" : 1421.3 }, "description" : "The kiwifruit, often shortened to kiwi in many parts of the world, is the edible berry of a woody vine in the genus Actinidia. The most common cultivar group of kiwifruit (''Hayward'') is oval, about the size of a large hen''s egg (5?8 centimetres in length and 4.5?5.5 centimetres in diameter). It has a fibrous, dull greenish-brown skin and bright green or golden flesh with rows of tiny, black, edible seeds. The fruit has a soft texture and a sweet but unique flavor, and today is a commercial crop in several countries, such as Italy, New Zealand, Chile, Greece and France." }');
INSERT INTO food_collection VALUES('{ "name" : "Onion", "group" : "Vegetables", "subgroup" : "Onion-family vegetables", "nutrients" : { "Carbohydrate" : 18057.407, "Energy" : 345.333, "Fat" : 0.0, "Fiber" : 2296.154, "Proteins" : 2150.741 }, "description" : "Allium haematochiton is a species of wild onion known by the common name redskin onion. It is native to northern Baja California and southern California. It it grows on the slopes of the coastal hills and mountains, such as those of the Peninsular Ranges, Transverse Ranges, and southern California Coast Ranges." }');
INSERT INTO food_collection VALUES('{ "name" : "Garlic", "group" : "Herbs and Spices", "subgroup" : "Herbs", "nutrients" : { "Carbohydrate" : 50898.333, "Energy" : 770.333, "Fat" : 0.0, "Fiber" : 3850.000, "Proteins" : 8301.667 }, "description" : "With a history of human use of over 7,000 years, garlic (Allium sativum) is native to central Asia, and has long been a staple in the Mediterranean region, as well as a frequent seasoning in Asia, Africa, and Europe. There are two sub-varieties of allium sativum: Allium sativum var. sativum (soft-necked garlic) and Allium sativum var. ophioscorodon (hard-necked garlic). Soft-necked garlic is the most commonly found. Bulb garlic is available in many forms, including fresh, frozen, dried, fermented (black garlic) and shelf stable products (in tubes or jars)." }');
INSERT INTO food_collection VALUES('{ "name" : "Cashew nut", "group" : "Nuts", "subgroup" : "Nuts", "nutrients" : { "Carbohydrate" : 33540.993, "Energy" : 1622.625, "Fat" : 15466.667, "Fiber" : 2381.818, "Proteins" : 13402.857 }, "description" : "The cashew, or caju, is a small tree native to Brazil. Cashew nuts are the seeds of the cashew apple, and are found in the grey bump at the end of the fruit. The cashew apple itself is sweet, soft and juicy.Cashews are usually sold roasted and salted and eaten as a snack." }');
INSERT INTO food_collection VALUES('{ "name" : "Pineapple", "group" : "Fruits", "subgroup" : "Tropical fruits", "nutrients" : { "Carbohydrate" : 17650.476, "Energy" : 179.613, "Fat" : 2188.600, "Fiber" : 705.263, "Proteins" : 542.857 }, "description" : "The Pineapple (Ananas comosus), named for its resemblance to the pine cone, is a tropical plant with edible multiple fruit consisting of coalesced berries, and the most economically significant plant in the Bromeliaceae family. Pineapples may be cultivated from a crown cutting of the fruit, possibly flowering in 20–24 months and fruiting in the following six months. Pineapple does not ripen significantly post-harvest. Pineapples are consumed fresh, cooked, juiced, and preserved, and are found in a wide array of cuisines. In addition to consumption, in the Philippines the pineapple''s leaves are used to produce the textile fiber piña- employed as a component of wall paper and furnishings, amongst other uses." }');
INSERT INTO food_collection VALUES('{ "name" : "Peanut", "group" : "Nuts", "subgroup" : "Nuts", "nutrients" : { "Carbohydrate" : 19706.341, "Energy" : 1571.563, "Fat" : 14543.900, "Fiber" : 6891.892, "Proteins" : 22098.293 }, "description" : "The peanut, also known as the groundnut and the goober and taxonomically classified as Arachis hypogaea, is a legume crop grown mainly for its edible seeds. It is widely grown in the tropics and subtropics, being important to both small and large commercial producers. It is classified as both a grain legume and, because of its high oil content, an oil crop. World annual production of shelled peanuts was 42 million tonnes in 2014. Atypically among crop plants, peanut pods develop underground rather than aboveground. It is this characteristic that the botanist Linnaeus used to assign the specific name hypogaea, which means ''under the earth''." }');
INSERT INTO food_collection VALUES('{ "name" : "Horseradish", "group" : "Herbs and Spices", "subgroup" : "Spices", "nutrients" : { "Carbohydrate" : 22922.500, "Energy" : 229.000, "Fat" : 700.000, "Fiber" : 3600.000, "Proteins" : 4557.500 }, "description" : "Horseradish (Armoracia rusticana, syn. Cochlearia armoracia) is a perennial plant of the Brassicaceae family (which also includes mustard, wasabi, broccoli, and cabbage). The plant is probably native to southeastern Europe and western Asia. It is now popular around the world. It grows up to 1.5 metres (5 feet) tall, and is cultivated primarily for its large, white, tapered root. The intact horseradish root has hardly any aroma. When cut or grated, however, enzymes from the now-broken plant cells break down sinigrin to produce allyl isothiocyanate, which irritates the mucous membranes of the sinuses and eyes. Once exposed to air (via grating) or heat, if not used immediately or mixed in vinegar, the grated mash darkens, loses its pungency, and becomes unpleasantly bitter-tasting." }');
INSERT INTO food_collection VALUES('{ "name" : "Asparagus", "group" : "Vegetables", "subgroup" : "Shoot vegetables", "nutrients" : { "Carbohydrate" : 4725.000, "Energy" : 58.364, "Fat" : 2150.000, "Fiber" : 1276.471, "Proteins" : 2872.889 }, "description" : "Asparagus officinalis is a spring vegetable, a flowering perennial plant species in the genus Asparagus. It was once classified in the lily family, like its Allium cousins, onions and garlic, but the Liliaceae have been split and the onion-like plants are now in the family Amaryllidaceae and asparagus in the Asparagaceae. Asparagus officinalis is native to most of Europe, northern Africa and western Asia, and is widely cultivated as a vegetable crop." }');
INSERT INTO food_collection VALUES('{ "name" : "Brazil nut", "group" : "Nuts", "subgroup" : "Nuts", "nutrients" : { "Carbohydrate" : 11897.863, "Energy" : 2082.000, "Fat" : 67459.500, "Fiber" : 4266.667, "Proteins" : 11679.000 }, "description" : "The Brazil nut (Bertholletia excelsa) is a South American tree in the family Lecythidaceae, and also the name of the tree''s commercially harvested edible seed." }');
INSERT INTO food_collection VALUES('{ "name" : "Common beet", "group" : "Vegetables", "subgroup" : "Leaf vegetables", "nutrients" : { "Carbohydrate" : 9100.909, "Energy" : 102.500, "Fat" : 0.0, "Fiber" : 2327.273, "Proteins" : 1490.000 }, "description" : "The beet (Beta vulgaris) is a plant in the Chenopodiaceae family which is now included in Amaranthaceae family. It is best known in its numerous cultivated varieties, the most well known of which is the root vegetable known as the beetroot or garden beet. However, other cultivated varieties include the leaf vegetable chard, as well as the root vegetable sugar beet, which is important in the production of table sugar, and mangelwurzel, which is a fodder crop. Three subspecies are typically recognised. All cultivated varieties fall into the subspecies Beta vulgaris subsp. vulgaris, while Beta vulgaris subsp. maritima, commonly known as the sea beet, is the wild ancestor of these, and is found throughout the Mediterranean, the Atlantic coast of Europe, the Near East, and India. A second wild subspecies, Beta vulgaris subsp. adanensis, occurs from Greece to Syria. The roots are most commonly deep red-purple in color, but come in a wide variety of other shades, including golden yellow and red-and-white striped. Beta vulgaris is a herbaceous biennial or, rarely, perennial plant with leafy stems growing to 1–2 m tall. The leaves are heart-shaped, 5–20 cm long on wild plants (often much larger in cultivated plants). The flowers are produced in dense spikes; each flower is very small, 3–5 mm diameter, green or tinged reddish, with five petals; they are wind pollinated. The fruit is a cluster of hard nutlets." }');
上述插入的資料可以用SELECT 查詢出來:
SELECT "name", "group", "subgroup", "nutrients", "description" FROM food_collection;
指定where條件以獲得更小的資料集:
SELECT "name", "group", "subgroup", "nutrients", "description" FROM food_collection WHERE "group" = 'Vegetables';
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2681274/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在SAP HANA Express Edition裡進行文字分析Express
- 使用nodejs應用查詢SAP HANA Express Edition裡的資料NodeJSExpress
- 使用PHP應用查詢SAP HANA Express Edition裡的資料PHPExpress
- SAP HANA Cloud 學習教程之二: 如何往SAP BTP 上 HANA Cloud 資料庫表裡插入資料Cloud資料庫
- 使用 csv 匯入的方式在 SAP S/4HANA 裡建立 employee 資料
- 如何在 SAP BTP Java 應用裡使用 SAP HANA 資料庫Java資料庫
- SAP Hybris Commerce裡的資料庫表資料庫
- 如何使用 Node.js 訪問 SAP HANA Cloud 資料庫裡的資料Node.jsCloud資料庫
- express入門04 資料庫連線 表結構建立 模型建立Express資料庫模型
- SAP S/4HANA裡如何建立Customer主資料以及執行後續處理
- 在 SAP Business Application Studio 裡訪問 SAP HANA Cloud 例項APPCloud
- 建立資料庫表資料庫
- 一種獲取SAP HANA資料庫表條目數的另類方法資料庫
- 使用 SSL 加密的 JDBC 連線 SAP HANA 資料庫加密JDBC資料庫
- SAP ABAP裡資料庫表的Storage Parameters從哪裡來的資料庫
- 如何在SAP S4HANA Cloud系統裡建立employeeCloud
- 如何用Java程式碼在SAP Marketing Cloud裡建立contact資料JavaCloud
- 資料庫 建立 3表資料庫
- Salesforce和SAP Netweaver裡資料庫表的後設資料設計Salesforce資料庫
- 使用JDBC操作SAP雲平臺上的HANA資料庫JDBC資料庫
- 使用ABAP(ADBC)和Java(JDBC)連線SAP HANA資料庫JavaJDBC資料庫
- 關於 SAP HANA 資料庫的死鎖問題(deadlock)資料庫
- SAP HANA資料建模祕籍XV
- SQL建立資料庫和表SQL資料庫
- 如何把 SAP ABAP 系統裡一張資料庫表的內容,顯示在 Adobe PDF Form 裡資料庫ORM
- HANA資料庫查詢大表佔用記憶體空間 for hana 2.0資料庫記憶體
- SAP中的資料庫表索引資料庫索引
- SAP HANA Cloud 學習教程之一: 如何在 SAP BTP 上建立 SAP HANA Cloud 例項Cloud
- 如何在SAP裡建立configurable material物料主資料
- 如何使用SAP HANA Vora規劃HANA大資料戰略?LH大資料
- SAP HANA 2.0版本升級,中國企業在選資料庫時是否會使用?資料庫
- 還在寫SQL做SAP二開?通過RFC呼叫NetWeaver,讓HANA資料庫操作更可靠SQL資料庫
- Express 文件(資料庫整合)Express資料庫
- 通過命令在navicat中建立資料庫及表結構資料庫
- 在 mysql 下 建立新的資料庫和對應的表MySql資料庫
- Classy:根據資料庫表在執行時建立類/模型資料庫模型
- DB2建立資料庫,建立表空間DB2資料庫
- 使用Eclipse連線SAP雲平臺上的HANA資料庫例項Eclipse資料庫