# Query: travel-sample # Flags: WordMatch RegExp # Including: ./docs-server # Excluding: *.html,*.json N1QL data query language pages modules/n1ql/pages/query.adoc: 34: FROM `travel-sample` r 35: JOIN `travel-sample` a modules/n1ql/pages/n1ql-intro/queriesandresults.adoc: 91: SELECT airportname FROM `travel-sample` WHERE city=$1 104: SELECT airportname FROM `travel-sample` Update example scope and collection names ("modes" and "train") modules/n1ql/pages/n1ql-intro/sysinfo.adoc: 50: For example, `default:{backtick}travel-sample{backtick}.modes.train` refers to the `train` collection in the `modes` scope in the `travel-sample` bucket. 54: So for example, we may refer to the `travel-sample` keyspace, meaning the default collection in the default scope in the `travel-sample` bucket. modules/n1ql/pages/n1ql-language-reference/advise.adoc: 312: FROM `travel-sample` r JOIN `travel-sample` a ON r.airlineid = META(a).id 346: FROM `travel-sample` r JOIN `travel-sample` a ON r.airline = a.iata 398: ADVISE SELECT * FROM `travel-sample` a WHERE a.type = 'hotel' AND a.country = 'France'; 412: "index_statement": "CREATE INDEX def_idx_type ON `travel-sample`(`type`)", 419: "index_statement": "CREATE INDEX adv_country_type ON `travel-sample`(`country`) WHERE `type` = 'hotel'", 422: "update_statistics": "UPDATE STATISTICS FOR `travel-sample`(`country`, `type`)" // <.> 428: "query": "SELECT * FROM `travel-sample` a WHERE a.type = 'hotel' AND a.country = 'France';" 441: ADVISE SELECT airportname FROM `travel-sample` WHERE type = 'airport' AND geo.alt NOT BETWEEN 0 AND 100; 455: "index_statement": "CREATE INDEX def_type ON `travel-sample`(`type`)", 456: "keyspace_alias": "travel-sample" 462: "index_statement": "CREATE INDEX adv_geo_alt_type_airportname ON `travel-sample`(`geo`.`alt`,`airportname`) WHERE `type` = 'airport'", 463: "keyspace_alias": "travel-sample" 468: "index_statement": "CREATE INDEX adv_geo_alt_type ON `travel-sample`(`geo`.`alt`) WHERE `type` = 'airport'", 469: "keyspace_alias": "travel-sample", 476: "query": "SELECT airportname FROM `travel-sample` WHERE type = 'airport' AND geo.alt NOT BETWEEN 0 AND 100;" 486: ADVISE SELECT * FROM `travel-sample` WHERE type LIKE 'air%'or type LIKE 'rou%'; 500: "index_statement": "CREATE INDEX def_type ON `travel-sample`(`type`)", 502: "keyspace_alias": "travel-sample", 509: "query": "SELECT * FROM `travel-sample` WHERE type LIKE 'air%'or type LIKE 'rou%';" 519: ADVISE SELECT type FROM `travel-sample` WHERE type LIKE 'air%'or type LIKE 'rou%'; 533: "index_statement": "CREATE INDEX def_type ON `travel-sample`(`type`)", 535: "keyspace_alias": "travel-sample" 541: "query": "SELECT type FROM `travel-sample` WHERE type LIKE 'air%'or type LIKE 'rou%';" 551: ADVISE SELECT * FROM `travel-sample` LIMIT 5; 565: "index_statement": "CREATE PRIMARY INDEX def_primary ON `travel-sample`", 566: "keyspace_alias": "travel-sample" 572: "query": "SELECT * FROM `travel-sample` LIMIT 5;" modules/n1ql/pages/n1ql-language-reference/advisor.adoc: 119: SELECT ADVISOR("SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'") AS Single; 130: "index": "CREATE INDEX def_type ON `travel-sample`(`type`)", 134: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 139: "index": "CREATE INDEX def_city ON `travel-sample`(`city`)", 143: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 150: "index": "CREATE INDEX adv_city_type ON `travel-sample`(`city`) WHERE `type` = 'hotel'", 154: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 192: SELECT ADVISOR(["SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'", "SELECT * FROM `travel-sample` h JOIN `travel-sample` a ON a.city = h.city WHERE h.type = 'hotel' AND a.type = 'airport'"]) AS Multiple; 203: "index": "CREATE INDEX def_city ON `travel-sample`(`city`)", 207: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 213: "index": "CREATE INDEX def_type ON `travel-sample`(`type`)", 217: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 225: "index": "CREATE INDEX adv_city_type ON `travel-sample`(`city`) WHERE `type` = 'hotel'", 229: "statement": "SELECT * FROM `travel-sample` WHERE type = 'hotel' AND city = 'Paris'" 233: "statement": "SELECT * FROM `travel-sample` h JOIN `travel-sample` a ON a.city = h.city WHERE h.type = 'hotel' AND a.type = 'airport'" 264: "index": "CREATE INDEX def_type ON `travel-sample`(`type`)", 268: "statement": "SELECT d.id, d.destinationairport, RATIO_TO_REPORT(d.distance) OVER (PARTITION BY d.destinationairport) AS `distance-ratio` FROM `travel-sample` AS d WHERE d.type='route' LIMIT 7;" 272: "statement": "SELECT * FROM `travel-sample` r WHERE r.type = 'airport' LIMIT 3;" 278: "index": "CREATE INDEX def_city ON `travel-sample`(`city`)", 282: "statement": "SELECT h.name, h.city, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' AND a.type = 'airport' LIMIT 5;" 291: "index": "CREATE INDEX adv_city_airportname ON `travel-sample`(`city`,`airportname`)", 295: "statement": "SELECT h.name, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' LIMIT 5;" 301: "index": "CREATE INDEX adv_city_type_name ON `travel-sample`(`city`,`name`) WHERE `type` = 'hotel'", 305: "statement": "SELECT h.name, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' LIMIT 5;" 314: "index": "CREATE INDEX adv_array_star_reviews_ratings_Cleanliness ON `travel-sample`(array_star((`reviews`)).`ratings`.`Cleanliness`)", 318: "statement": "SELECT ARRAY_AGG(reviews[*].ratings.Cleanliness) AS Reviews FROM `travel-sample`;" 324: "index": "CREATE INDEX adv_city_type ON `travel-sample`(`city`) WHERE `type` = 'hotel'", 328: "statement": "SELECT h.name, h.city, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' AND a.type = 'airport' LIMIT 5;" 730: "index": "CREATE INDEX def_type ON `travel-sample`(`type`)", 734: "statement": "SELECT h.name, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' LIMIT 5;" 743: "index": "CREATE INDEX adv_city_type_name ON `travel-sample`(`city`,`name`) WHERE `type` = 'hotel'", 747: "statement": "SELECT h.name, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' LIMIT 5;" 755: "index": "CREATE INDEX adv_city_type ON `travel-sample`(`city`) WHERE `type` = 'hotel'", 759: "statement": "SELECT h.name, a.airportname FROM `travel-sample` h JOIN `travel-sample` a ON h.city = a.city WHERE h.type = 'hotel' LIMIT 5;" Check use of beer-sample! modules/n1ql/pages/n1ql-language-reference/explain.adoc: 15: To execute the following statement, user must have the _Query Insert_ privilege on `pass:c[`travel-sample`]` and the _Query Select_ privilege on `pass:c[`beer-sample`]`. 18: EXPLAIN INSERT INTO `travel-sample` (KEY foo, VALUE bar) SELECT foo, bar FROM `beer-sample` Update example scope and collection names ("modes" and "train") modules/n1ql/pages/n1ql-language-reference/from.adoc: 133: For example, `default:{backtick}travel-sample{backtick}` indicates the default collection in the default scope in the `travel-sample` bucket in the `default` namespace. 135: Similarly, `default:{backtick}travel-sample{backtick}.places.cities` indicates the `cities` collection in the `places` scope in the `travel-sample` bucket in the `default` namespace. 179: Select four unique landmarks from the `{backtick}travel-sample{backtick}` keyspace. 184: FROM `travel-sample` 256: FROM `travel-sample` 305: FROM `travel-sample` 341: FROM `travel-sample` 349: FROM `travel-sample` 409: FROM `travel-sample` t 457: FROM `travel-sample` AS t 462: FROM `travel-sample` t 467: FROM `travel-sample` AS h 468: INNER JOIN `travel-sample` AS l 474: FROM `travel-sample` h 475: INNER JOIN `travel-sample` l modules/n1ql/pages/n1ql-language-reference/groupby.adoc: 98: FROM `travel-sample` 134: FROM `travel-sample` 162: FROM `travel-sample` 199: FROM `travel-sample` 236: FROM `travel-sample` 276: FROM `travel-sample` AS l modules/n1ql/pages/n1ql-language-reference/hints.adoc: 65: FROM `travel-sample` 74: "travel-sample": { 99: FROM `travel-sample` 108: "travel-sample": { 125: "travel-sample": { 215: ON `travel-sample` (airlineid, airline, destinationairport) 222: FROM `travel-sample` USE INDEX (idx_destinations USING GSI) 236: FROM `travel-sample` USE INDEX (USING FTS) modules/n1ql/pages/n1ql-language-reference/index.adoc: 83: For example, the latitude of a location in the `type="airport"` documents in the `pass:c[`travel-sample`]` are in the `geo` sub-document and can be addressed as the nested path `pass:c[`travel-sample`.geo.lat]`: 87: FROM `travel-sample` t1 modules/n1ql/pages/n1ql-language-reference/infer.adoc: 25: To execute the following statement, you must have the _Query Select_ privilege on `pass:c[`travel-sample`]`. 29: INFER `travel-sample` modules/n1ql/pages/n1ql-language-reference/join.adoc: 90: FROM `travel-sample` r 91: JOIN `travel-sample` a 100: FROM `travel-sample` r 101: LEFT JOIN `travel-sample` a 111: FROM `travel-sample` r 112: RIGHT JOIN `travel-sample` a 158: FROM `travel-sample` route 159: INNER JOIN `travel-sample` airline 203: FROM `travel-sample` aport 204: LEFT JOIN `travel-sample` lmark 254: FROM `travel-sample` aport 255: RIGHT JOIN `travel-sample` lmark 445: Find the destination airport of all routes in the `travel-sample` keyspace whose source airport is in San Francisco. 450: FROM `travel-sample` airport JOIN ( 452: FROM `travel-sample` 492: FROM `travel-sample` airport JOIN [ 597: FROM `travel-sample` rte 598: INNER JOIN `travel-sample` aline 623: FROM `travel-sample` aline 624: INNER JOIN `travel-sample` rte 668: FROM `travel-sample` rte 669: INNER JOIN `travel-sample` aline 717: FROM `travel-sample` rte 718: INNER JOIN `travel-sample` aline 731: FROM `travel-sample` rte 732: INNER JOIN `travel-sample` aline 1061: List all airlines and non-stop routes from SFO in the `travel-sample` keyspace. 1066: FROM `travel-sample` route 1067: JOIN `travel-sample` airline 1115: List the schedule of flights from Boston to San Francisco on JETBLUE in the `travel-sample` keyspace. 1120: FROM `travel-sample` route 1121: JOIN `travel-sample` airline 1367: FROM `travel-sample` route 1368: JOIN `travel-sample` airline 1387: CREATE INDEX route_airlineid ON `travel-sample`(airlineid) WHERE type="route"; 1393: CREATE INDEX airline_icao ON `travel-sample`(icao) WHERE type="airline"; 1399: SELECT * FROM `travel-sample` airline 1400: JOIN `travel-sample` route 1437: CREATE INDEX route_airlineid ON `travel-sample`(airlineid) WHERE type="route"; 1443: FROM `travel-sample` airline 1444: JOIN `travel-sample` route 1488: FROM `travel-sample` r 1489: JOIN `travel-sample` a 1518: FROM `travel-sample` r 1519: JOIN `travel-sample` 1549: FROM `travel-sample` a 1550: JOIN `travel-sample` r modules/n1ql/pages/n1ql-language-reference/let.adoc: 18: FROM `travel-sample` 68: FROM `travel-sample` t1 71: FROM `travel-sample` t2 107: FROM `travel-sample` AS t1 149: FROM `travel-sample` t1 153: FROM `travel-sample` t2 modules/n1ql/pages/n1ql-language-reference/limit.adoc: 35: FROM `travel-sample` 66: FROM `travel-sample` N1QL Auditing is due to be deleted modules/n1ql/pages/n1ql-language-reference/n1ql-auditing.adoc: 59: | `pass:c[SELECT * FROM `travel-sample`]` modules/n1ql/pages/n1ql-language-reference/nest.adoc: 135: FROM `travel-sample` r 136: NEST `travel-sample` a 277: Show one set of routes for one airline in the `travel-sample` keyspace. 282: FROM `travel-sample` route 283: INNER NEST `travel-sample` airline 532: CREATE INDEX idx_inest ON `travel-sample`(airlineid); 538: FROM `travel-sample` aline 539: INNER NEST `travel-sample` rte 841: FROM `travel-sample` r 842: NEST `travel-sample` a 871: FROM `travel-sample` r 872: NEST `travel-sample` a 904: FROM `travel-sample` a 905: NEST `travel-sample` r modules/n1ql/pages/n1ql-language-reference/offset.adoc: 32: FROM `travel-sample` modules/n1ql/pages/n1ql-language-reference/orderby.adoc: 118: FROM `travel-sample` 157: FROM `travel-sample` 160: FROM `travel-sample` modules/n1ql/pages/n1ql-language-reference/prepare.adoc: 74: SELECT * FROM `travel-sample` 87: SELECT * FROM `travel-sample` 100: SELECT * FROM `travel-sample` 228: To execute the following statement, user must have the _Query Select_ privilege on both keyspaces `pass:c[`travel-sample`]` and `pass:c[`beer-sample`]`. 233: PREPARE SELECT * FROM `travel-sample` 238: To execute the following statement, user must have the _Query Update_ and _Query Select_ privileges on `pass:c[`travel-sample`]`. 243: PREPARE UPDATE `travel-sample` 256: PREPARE SELECT * FROM `travel-sample` 279: "Target": "default:travel-sample" 293: "keyspace": "travel-sample", 311: "keyspace": "travel-sample", 321: "condition": "(((`travel-sample`.`type`) = \"route\") and ((`travel-sample`.`airline`) = \"FL\"))" 349: "text": "PREPARE SELECT * FROM `travel-sample`\nWHERE type = \"route\"\nAND airline = \"FL\";" modules/n1ql/pages/n1ql-language-reference/selectclause.adoc: 83: | Q1: `pass:c[SELECT city FROM `travel-sample`;]` 87: | Q2: `pass:c[SELECT META().id FROM `travel-sample`;]` 95: EXPLAIN SELECT DISTINCT city FROM `travel-sample`; 105: "keyspace": "travel-sample", 111: "keyspace": "travel-sample", 124: "expr": "(`travel-sample`.`city`)" 142: "text": "SELECT DISTINCT city\nFROM `travel-sample`;" 176: `pass:c[FROM `travel-sample`]` 183: `pass:c[FROM `travel-sample`]` 190: `pass:c[FROM `travel-sample`]` 211: SELECT * FROM `travel-sample` WHERE type="hotel"; 216: "travel-sample": { / added line with keyspace 224: SELECT `travel-sample`.* FROM `travel-sample` WHERE type="hotel"; 236: SELECT meta().id,email,city,phone,`travel-sample`.reviews[0].ratings 237: FROM `travel-sample` WHERE type="hotel" LIMIT 5; 263: SELECT id, airline, stops FROM `travel-sample` WHERE type="route"; 269: SELECT schedule[0].day FROM `travel-sample` WHERE type="route"; 287: *Example 1*: Select all the fields of 1 document of type `airline` from the `travel-sample` keyspace. 290: SELECT * FROM `travel-sample` WHERE type="airline" LIMIT 1; 295: "travel-sample": { 308: *Example 2*: Select all the fields of 1 document of type `landmark` from the `travel-sample` keyspace. 311: SELECT * FROM `travel-sample` WHERE type="landmark" LIMIT 1; 316: "travel-sample": { modules/n1ql/pages/n1ql-language-reference/selectintro.adoc: 34: To execute the following statement, the user must have the _Query Select_ privilege on `pass:c[`travel-sample`]`. 38: SELECT * FROM `travel-sample` 41: To execute the following statement, the user must have the _Query Select_ privilege on `pass:c[`travel-sample`]` and `pass:c[`beer-sample`]`. 45: SELECT * FROM `travel-sample` t 49: To execute the following statement, the user must have the _Query Select_ privilege on `pass:c[`travel-sample`]` and `pass:c[`beer-sample`]`. 53: SELECT * FROM `travel-sample` 57: To execute the following statement, the user must have the _Query Select_ privilege on `pass:c[`travel-sample`]` and `pass:c[`beer-sample`]`. 61: SELECT * FROM `travel-sample` WHERE type = "hotel" 73: FROM `travel-sample` t 97: SELECT * FROM `travel-sample` USE KEYS "airport_3469"; 105: "travel-sample": { 222: FROM `travel-sample` 233: "travel-sample": { 250: "travel-sample": { 275: Before we delve into examples, let's take a look at the data model of the travel-sample keyspace, which is used in the following examples. 278: .Data model of travel-sample keyspace 293: FROM `travel-sample` route 294: JOIN `travel-sample` airline 342: CREATE INDEX route_airlineid ON `travel-sample`(airlineid) 352: FROM `travel-sample` airline 353: JOIN `travel-sample` route 385: FROM `travel-sample` t 419: FROM `travel-sample` t 441: * The ‘airline’ field in the result is an array of the `travel-sample` documents that are matched with the key route.airlineid. 451: FROM `travel-sample` route NEST `travel-sample` airline 493: FROM `travel-sample` t UNNEST t.reviews r 529: FROM `travel-sample` t 556: FROM `travel-sample` t 562: FROM `travel-sample` t 605: FROM `travel-sample` t 666: CREATE INDEX `def_faa` ON `travel-sample`(`faa`); 672: EXPLAIN SELECT faa FROM `travel-sample`; -- <1> 691: "keyspace": "travel-sample", 706: EXPLAIN SELECT faa FROM `travel-sample` WHERE faa IS NOT MISSING; -- <1> 719: "cover ((`travel-sample`.`faa`))", 720: "cover ((meta(`travel-sample`).`id`))" modules/n1ql/pages/n1ql-language-reference/union.adoc: 39: Q1: SELECT DISTINCT city FROM `travel-sample` WHERE type = "airport"; (1641 results) 41: Q2: SELECT DISTINCT city FROM `travel-sample` WHERE type = "hotel"; (274 results) 47: SELECT DISTINCT city FROM `travel-sample` WHERE type = "airport" 48: UNION SELECT DISTINCT city FROM `travel-sample` WHERE type = "hotel"; 73: SELECT DISTINCT city FROM `travel-sample` WHERE type = "airport" 74: INTERSECT SELECT DISTINCT city FROM `travel-sample` WHERE type = "hotel"; 99: SELECT DISTINCT city FROM `travel-sample` WHERE type = "airport" 100: EXCEPT SELECT DISTINCT city FROM `travel-sample` WHERE type = "hotel"; 125: SELECT DISTINCT city FROM `travel-sample` WHERE type = "hotel" 126: UNION SELECT DISTINCT city FROM `travel-sample` WHERE type = "airport"; modules/n1ql/pages/n1ql-language-reference/unnest.adoc: 76: In the `travel-sample` keyspace, flatten the schedule array to get a list of the flights on Monday (`1`). 81: FROM `travel-sample` 120: FROM `travel-sample` 211: FROM `travel-sample` 213: WHERE `travel-sample`.type = "hotel" modules/n1ql/pages/n1ql-language-reference/where.adoc: 14: FROM `travel-sample` 48: FROM `travel-sample` 88: FROM `travel-sample` 120: FROM `travel-sample` modules/n1ql/pages/n1ql-language-reference/with.adoc: 57: FROM `travel-sample` AS cte 60: FROM `travel-sample` AS hotel 102: FROM `travel-sample` modules/n1ql/pages/n1ql-rest-api/index.adoc: 67: $ curl -v http://172.23.99.98:8093/query/service -d 'statement=SELECT meta().id FROM `travel-sample` WHERE type = "hotel" and meta().id LIKE $1 &args=["hotel_1002%25"]' modules/n1ql/partials/n1ql-language-reference/from-term.adoc: 20: `travel-sample` 35: FROM `travel-sample` 47: FROM `travel-sample` AS rte 48: JOIN `travel-sample` AS aln 50: NEST `travel-sample` AS lmk