1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["110284"],{747025(e,n,s){s.r(n),s.d(n,{metadata:()=>l,default:()=>h,frontMatter:()=>r,contentTitle:()=>a,toc:()=>o,assets:()=>d});var l=JSON.parse('{"id":"reference/sql/select","title":"SELECT","description":"Spice is built on Apache DataFusion and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects.","source":"@site/versioned_docs/version-2.0.x/reference/sql/select.md","sourceDirName":"reference/sql","slug":"/reference/sql/select","permalink":"/docs/v2.0/reference/sql/select","draft":false,"unlisted":false,"editUrl":"https://github.com/spiceai/docs/edit/trunk/website/versioned_docs/version-2.0.x/reference/sql/select.md","tags":[],"version":"2.0.x","sidebarPosition":1,"frontMatter":{"title":"SELECT","sidebar_label":"SELECT","pagination_prev":"reference/sql/index","pagination_next":"reference/sql/operators","sidebar_position":1},"sidebar":"docs","previous":{"title":"SQL Reference","permalink":"/docs/v2.0/reference/sql/"},"next":{"title":"Operators","permalink":"/docs/v2.0/reference/sql/operators"}}'),i=s(474848),c=s(28453);let r={title:"SELECT",sidebar_label:"SELECT",pagination_prev:"reference/sql/index",pagination_next:"reference/sql/operators",sidebar_position:1},a,d={},o=[{value:"SELECT syntax",id:"select-syntax",level:2},{value:"Window Functions (OVER Clause)",id:"window-functions-over-clause",level:3},{value:"WITH clause",id:"with-clause",level:3},{value:"SELECT clause",id:"select-clause",level:3},{value:"FROM clause",id:"from-clause",level:3},{value:"WHERE clause",id:"where-clause",level:3},{value:"JOIN clause",id:"join-clause",level:3},{value:"INNER JOIN",id:"inner-join",level:4},{value:"LEFT OUTER JOIN",id:"left-outer-join",level:4},{value:"RIGHT OUTER JOIN",id:"right-outer-join",level:4},{value:"FULL OUTER JOIN",id:"full-outer-join",level:4},{value:"NATURAL JOIN",id:"natural-join",level:4},{value:"CROSS JOIN",id:"cross-join",level:4},{value:"GROUP BY clause",id:"group-by-clause",level:3},{value:"<code>GROUP BY ALL</code>",id:"group-by-all",level:4},{value:"HAVING clause",id:"having-clause",level:3},{value:"QUALIFY clause",id:"qualify-clause",level:3},{value:"UNION clause",id:"union-clause",level:3},{value:"ORDER BY clause",id:"order-by-clause",level:3},{value:"<code>ORDER BY ALL</code>",id:"order-by-all",level:4},{value:"LIMIT clause",id:"limit-clause",level:3},{value:"EXCLUDE, EXCEPT, REPLACE, and ILIKE clauses",id:"exclude-except-replace-and-ilike-clauses",level:3},{value:"Additional Example",id:"additional-example",level:3}];function t(e){let n={a:"a",admonition:"admonition",br:"br",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["Spice is built on ",(0,i.jsx)(n.a,{href:"https://datafusion.apache.org/",children:"Apache DataFusion"})," and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects."]})}),"\n",(0,i.jsx)(n.h2,{id:"select-syntax",children:"SELECT syntax"}),"\n",(0,i.jsx)(n.p,{children:"The queries in Spice scan data from tables and return 0 or more rows."}),"\n",(0,i.jsx)(n.p,{children:"Spice follows PostgreSQL conventions for identifier handling: unquoted identifiers (table and column names) are normalized to lowercase. To reference a table or column with uppercase or mixed-case characters, wrap the identifier in double quotes."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:'-- These are equivalent (both reference the lowercase table name)\nSELECT * FROM lineitem;\nSELECT * FROM LINEITEM;\n\n-- Double quotes preserve the exact casing\nSELECT * FROM "LINEITEM";\n'})}),"\n",(0,i.jsxs)(n.p,{children:["See ",(0,i.jsxs)(n.a,{href:"../spicepod/datasets#name",children:["dataset ",(0,i.jsx)(n.code,{children:"name"})," configuration"]})," for how to set a case-sensitive dataset name in the Spicepod manifest."]}),"\n",(0,i.jsx)(n.p,{children:"Spice supports the following syntax for queries:"}),"\n",(0,i.jsxs)(n.p,{children:["[ ",(0,i.jsx)(n.a,{href:"#with-clause",children:"WITH"})," with_query [, ...] ]",(0,i.jsx)(n.br,{}),"\n",(0,i.jsx)(n.a,{href:"#select-clause",children:"SELECT"})," [ ALL | DISTINCT ] select_expr [, ...]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#from-clause",children:"FROM"})," from_item [, ...] ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#join-clause",children:"JOIN"})," join_item [, ...] ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#where-clause",children:"WHERE"})," condition ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#group-by-clause",children:"GROUP BY"})," grouping_element [, ...] ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#having-clause",children:"HAVING"})," condition]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#qualify-clause",children:"QUALIFY"})," condition ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#union-clause",children:"UNION"})," [ ALL | select ] ]\n[ ",(0,i.jsx)(n.a,{href:"#order-by-clause",children:"ORDER BY"})," expression [ ASC | DESC ][, ...] ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#limit-clause",children:"LIMIT"})," count ]",(0,i.jsx)(n.br,{}),"\n","[ ",(0,i.jsx)(n.a,{href:"#exclude-except-replace-and-ilike-clauses",children:"EXCLUDE | EXCEPT"})," ]"]}),"\n",(0,i.jsx)(n.h3,{id:"window-functions-over-clause",children:"Window Functions (OVER Clause)"}),"\n",(0,i.jsxs)(n.p,{children:["Window functions perform calculations across a set of rows related to the current row. Use the ",(0,i.jsx)(n.code,{children:"OVER"})," clause to define the window:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n employee_id,\n salary,\n ROW_NUMBER() OVER (ORDER BY salary DESC) AS salary_rank,\n SUM(salary) OVER (PARTITION BY dept_id) AS dept_total\nFROM employees;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"OVER"})," clause supports:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"PARTITION BY"}),": Divides rows into groups"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"ORDER BY"}),": Defines row ordering within each partition"]}),"\n",(0,i.jsxs)(n.li,{children:["Frame specifications: ",(0,i.jsx)(n.code,{children:"ROWS BETWEEN ... AN
1D ..."})]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"with-clause",children:"WITH clause"}),"\n",(0,i.jsx)(n.p,{children:"A WITH clause assigns names to subqueries so they can be referenced by name."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"WITH x AS (SELECT a, MAX(b) AS b FROM t GROUP BY a)\nSELECT a, b FROM x;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"select-clause",children:"SELECT clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"SELECT"})," clause is used to select data from a database by defining the colummns it returns. Each ",(0,i.jsx)(n.code,{children:"select_expr"})," in the\nSELECT list can be an expression or wildcards."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a, b, a + b FROM table;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"DISTINCT"})," quantifier can be added to make the query return all distinct rows.\nBy default ",(0,i.jsx)(n.code,{children:"ALL"})," will be used, which returns all the rows."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT DISTINCT person, age FROM employees;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"from-clause",children:"FROM clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"FROM"})," clause is used to specify which table to select data from."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT t.a FROM table AS t;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"where-clause",children:"WHERE clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"WHERE"})," clause is used define the conditions to filter the query results."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a FROM table WHERE a > 10;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"join-clause",children:"JOIN clause"}),"\n",(0,i.jsxs)(n.p,{children:["Spice supports ",(0,i.jsx)(n.code,{children:"INNER JOIN"}),", ",(0,i.jsx)(n.code,{children:"LEFT OUTER JOIN"}),", ",(0,i.jsx)(n.code,{children:"RIGHT OUTER JOIN"}),", ",(0,i.jsx)(n.code,{children:"FULL OUTER JOIN"}),", ",(0,i.jsx)(n.code,{children:"NATURAL JOIN"})," and ",(0,i.jsx)(n.code,{children:"CROSS JOIN"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"The following examples are based on this table:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x;\n+----------+----------+\n| column_1 | column_2 |\n+----------+----------+\n| 1 | 2 |\n+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"inner-join",children:"INNER JOIN"}),"\n",(0,i.jsxs)(n.p,{children:["The keywords ",(0,i.jsx)(n.code,{children:"JOIN"})," or ",(0,i.jsx)(n.code,{children:"INNER JOIN"})," define a join that only shows rows where there is a match in both tables."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x inner join x y ON x.column_1 = y.column_1;\n+----------+----------+----------+----------+\n| column_1 | column_2 | column_1 | column_2 |\n+----------+----------+----------+----------+\n| 1 | 2 | 1 | 2 |\n+----------+----------+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"left-outer-join",children:"LEFT OUTER JOIN"}),"\n",(0,i.jsxs)(n.p,{children:["The keywords ",(0,i.jsx)(n.code,{children:"LEFT JOIN"})," or ",(0,i.jsx)(n.code,{children:"LEFT OUTER JOIN"})," define a join that includes all rows from the left table even if there\nis not a match in the right table. When there is no match, null values are produced for the right side of the join."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x left join x y ON x.column_1 = y.column_2;\n+----------+----------+----------+----------+\n| column_1 | column_2 | column_1 | column_2 |\n+----------+----------+----------+----------+\n| 1 | 2 | | |\n+----------+----------+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"right-outer-join",children:"RIGHT OUTER JOIN"}),"\n",(0,i.jsxs)(n.p,{children:["The keywords ",(0,i.jsx)(n.code,{children:"RIGHT JOIN"})," or ",(0,i.jsx)(n.code,{children:"RIGHT OUTER JOIN"})," define a join that includes all rows from the right table even if there\nis not a match in the left table. When there is no match, null values are produced for the left side of the join."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x right join x y ON x.column_1 = y.column_2;\n+----------+----------+----------+----------+\n| column_1 | column_2 | column_1 | column_2 |\n+----------+----------+----------+----------+\n| | | 1 | 2 |\n+----------+----------+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"full-outer-join",children:"FULL OUTER JOIN"}),"\n",(0,i.jsxs)(n.p,{children:["The keywords ",(0,i.jsx)(n.code,{children:"FULL JOIN"})," or ",(0,i.jsx)(n.code,{children:"FULL OUTER JOIN"})," define a join that is effectively a union of a ",(0,i.jsx)(n.code,{children:"LEFT OUTER JOIN"})," and\n",(0,i.jsx)(n.code,{children:"RIGHT OUTER JOIN"}),". It will show all rows from the left and right side of the join and will produce null values on\neither side of the join where there is not a match."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x full outer join x y ON x.column_1 = y.column_2;\n+----------+----------+----------+----------+\n| column_1 | column_2 | column_1 | column_2 |\n+----------+----------+----------+----------+\n| 1 | 2 | | |\n| | | 1 | 2 |\n+----------+----------+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"natural-join",children:"NATURAL JOIN"}),"\n",(0,i.jsx)(n.p,{children:"A natural join defines an inner join based on common column names found between the input tables. When no common\ncolumn names are found, it behaves like a cross join."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x natural join x y;\n+----------+----------+\n| column_1 | column_2 |\n+----------+----------+\n| 1 | 2 |\n+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h4,{id:"cross-join",children:"CROSS JOIN"}),"\n",(0,i.jsx)(n.p,{children:"A cross join produces a cartesian product that matches every row in the left side of the join with every row in the\nright side of the join."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"select * from x cross join x y;\n+----------+----------+----------+----------+\n| column_1 | column_2 | column_1 | column_2 |\n+----------+----------+----------+----------+\n| 1 | 2 | 1 | 2 |\n+----------+----------+----------+----------+\n"})}),"\n",(0,i.jsx)(n.h3,{id:"group-by-clause",children:"GROUP BY clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"GROUP BY"})," clause groups together input rows that have the same value into summary rows."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"GROUP BY"})," is typically used with aggregrate functions (",(0,i.jsx)(n.code,{children:"COUNT()"}),", ",(0,i.jsx)(n.code,{children:"MAX()"}),", ",(0,i.jsx)(n.code,{children:"SUM()"}),"), but if no aggregate functions are\nincluded, the query with a ",(0,i.jsx)(n.code,{children:"GROUP BY"})," clause is the same as ",(0,i.jsx)(n.code,{children:"SELECT DISTINCT"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a, b, MAX(c) FROM table GROUP BY a, b;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Some aggregation functions accept optional ordering requirement, such as ",(0,i.jsx)(n.code,{children:"ARRAY_AGG"}),". If a requirement is given,\naggregation is calculated in the order of the requirement."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a, b, ARRAY_AGG(c, ORDER BY d) FROM table GROUP BY a, b;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"group-by-all",children:(0,i.jsx)(n.code,{children:"GROUP BY ALL"})}),"\n",(0,i.jsx)(n.p,{children:"Use GROUP BY ALL to group by every column in the SELECT list that isn\u2019t inside an aggregate function. This keeps the column definitions in one place, simplifies the query, and prevents bugs by keeping the SELECT granularity aligned with the GROUP BY granularity (e.g., preventing unintended duplication)."}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a, b, MAX(c) FROM table GROUP BY ALL;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"having-clause",children:"HAVING clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"HAVING"})," clause can be used with ",(0,i.jsx)(n.code,{children:"GROUP BY"})," to eliminate groups that don't satisfy the condition given."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT a, b, MAX(c) FROM table GROUP BY a, b HAVING MAX(c) > 10;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"qualify-clause",children:"QUALIFY clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"QUALIFY"})," clause filters the results of window functions. It is evaluated after window functions are computed, similar to how ",(0,i.jsx)(n.code,{children:"HAVING"})," filters results after ",(0,i.jsx)(n.code,{children:"GROUP BY"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n employee_id,\n dept_id,\n salary,\n ROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rank\nFROM employees\nQUALIFY rank <= 3;\n"})}),"\n",(0,i.jsx)(n.p,{children:"This query returns only the top 3 highest-paid employees in each department."}),"\n",(0,i.jsx)(n.h3,{id:"union-clause",children:"UNION clause"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"UNION"})," clause combines the results of two or more ",(0,i.jsx)(n.code,{children:"SELECT"})," statements. By default ",(0,i.jsx)(n.code,{children:"UNION"})," removes\nduplicates. To include duplicates, use ",(0,i.jsx)(n.code,{children:"UNION ALL"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n a,\n b,\n c\nFROM table1\nUNION ALL\nSELECT\n a,\n b,\n c\nFROM table2;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"order-by-clause",children:"ORDER BY clause"}),"\n",(0,i.jsxs)(n.p,{children:["Orders the results by the referenced expression. By default it uses ascending order (",(0,i.jsx)(n.code,{children:"ASC"}),").\nThis order can be changed to descending by adding ",(0,i.jsx)(n.code,{children:"DESC"})," after the order-by expressions."]}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT age, person FROM table ORDER BY age;\nSELECT age, person FROM table ORDER BY age DESC;\nSELECT age, person FROM table ORDER BY age, person DESC;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"order-by-all",children:(0,i.jsx)(n.code,{children:"ORDER BY ALL"})}),"\n",(0,i.jsx)(n.p,{children:"Order from left to right (by age, then by person) in ascending order:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT age, person FROM table ORDER BY ALL;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"limit-clause",children:"LIMIT clause"}),"\n",(0,i.jsxs)(n.p,{children:["Limits the number of rows to be a maximum of ",(0,i.jsx)(n.code,{children:"count"})," rows. ",(0,i.jsx)(n.code,{children:"count"})," should be a non-negative integer."]}),"\n",(0,i.jsx)(n.p,{children:"Example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT age, person FROM table\nLIMIT 10;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"exclude-except-replace-and-ilike-clauses",children:"EXCLUDE, EXCEPT, REPLACE, and ILIKE clauses"}),"\n",(0,i.jsxs)(n.p,{children:["Spice supports the following wildcard modifiers on ",(0,i.jsx)(n.code,{children:"SELECT *"}),":"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"EXCLUDE (col1, col2, ...)"})," / ",(0,i.jsx)(n.code,{children:"EXCEPT (col1, col2, ...)"})," \u2014 omit the named columns."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"REPLACE (ex
1pr AS col, ...)"})," \u2014 substitute the named columns with a new expression."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"ILIKE 'pattern'"})," \u2014 emit only columns whose names match the case-insensitive pattern."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RENAME"})," is parsed but not yet implemented."]}),"\n",(0,i.jsxs)(n.p,{children:["Example selecting all columns except for ",(0,i.jsx)(n.code,{children:"age"})," and ",(0,i.jsx)(n.code,{children:"person"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT * EXCEPT(age, person)\nFROM table;\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT * EXCLUDE(age, person)\nFROM table;\n"})}),"\n",(0,i.jsx)(n.p,{children:"Example replacing a column's value while keeping all other columns:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT * REPLACE (upper(name) AS name)\nFROM customers;\n"})}),"\n",(0,i.jsx)(n.p,{children:'Example selecting all columns whose names contain "date":'}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT * ILIKE '%date%'\nFROM events;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"additional-example",children:"Additional Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT name, age FROM employees WHERE age > 30 ORDER BY age DESC;\n"})})]})}function h(e={}){let{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}},28453(e,n,s){s.d(n,{R:()=>r,x:()=>a});var l=s(296540);let i={},c=l.createContext(i);function r(e){let n=l.useContext(c);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),l.createElement(c.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.