blob: 922161d673647ada61c3c526d9fbaaca12d124fc [file] [log] [blame]
"use strict";(self.webpackChunkdoris_website=self.webpackChunkdoris_website||[]).push([[60821],{15680:(e,n,t)=>{t.d(n,{xA:()=>c,yg:()=>d});var r=t(296540);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},y=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),y=a,d=u["".concat(s,".").concat(y)]||u[y]||m[y]||l;return t?r.createElement(d,o(o({ref:n},c),{},{components:t})):r.createElement(d,o({ref:n},c))}));function d(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=y;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var p=2;p<l;p++)o[p]=t[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}y.displayName="MDXCreateElement"},129734:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var r=t(58168),a=(t(296540),t(15680));const l={title:"least",language:"en"},o=void 0,i={unversionedId:"sql-manual/sql-functions/math-functions/least",id:"version-1.2/sql-manual/sql-functions/math-functions/least",title:"least",description:"\x3c!--",source:"@site/versioned_docs/version-1.2/sql-manual/sql-functions/math-functions/least.md",sourceDirName:"sql-manual/sql-functions/math-functions",slug:"/sql-manual/sql-functions/math-functions/least",permalink:"/docs/1.2/sql-manual/sql-functions/math-functions/least",draft:!1,tags:[],version:"1.2",frontMatter:{title:"least",language:"en"},sidebar:"docs",previous:{title:"greatest",permalink:"/docs/1.2/sql-manual/sql-functions/math-functions/greatest"},next:{title:"random",permalink:"/docs/1.2/sql-manual/sql-functions/math-functions/random"}},s={},p=[{value:"least",id:"least",level:2},{value:"description",id:"description",level:3},{value:"Syntax",id:"syntax",level:4},{value:"example",id:"example",level:3},{value:"keywords",id:"keywords",level:3}],c={toc:p},u="wrapper";function m(e){let{components:n,...t}=e;return(0,a.yg)(u,(0,r.A)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.yg)("h2",{id:"least"},"least"),(0,a.yg)("h3",{id:"description"},"description"),(0,a.yg)("h4",{id:"syntax"},"Syntax"),(0,a.yg)("p",null,(0,a.yg)("inlineCode",{parentName:"p"},"least(col_a, col_b, \u2026, col_n)")," "),(0,a.yg)("p",null,(0,a.yg)("inlineCode",{parentName:"p"},"column")," supports the following types: ",(0,a.yg)("inlineCode",{parentName:"p"},"TINYINT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"SMALLINT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"INT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"BIGINT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"LARGEINT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"FLOAT")," ",(0,a.yg)("inlineCode",{parentName:"p"},"DOUBLE")," ",(0,a.yg)("inlineCode",{parentName:"p"},"STRING")," ",(0,a.yg)("inlineCode",{parentName:"p"},"DATETIME")," ",(0,a.yg)("inlineCode",{parentName:"p"},"DECIMAL")),(0,a.yg)("p",null,"Compare the size of ",(0,a.yg)("inlineCode",{parentName:"p"},"n columns")," and return the smallest among them. If there is ",(0,a.yg)("inlineCode",{parentName:"p"},"NULL")," in ",(0,a.yg)("inlineCode",{parentName:"p"},"column"),", return ",(0,a.yg)("inlineCode",{parentName:"p"},"NULL"),"."),(0,a.yg)("h3",{id:"example"},"example"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},"mysql> select least(-1, 0, 5, 8);\n+--------------------+\n| least(-1, 0, 5, 8) |\n+--------------------+\n| -1 |\n+--------------------+\nmysql> select least(-1, 0, 5, NULL);\n+-----------------------+\n| least(-1, 0, 5, NULL) |\n+-----------------------+\n| NULL |\n+-----------------------+\nmysql> select least(6.3, 4.29, 7.6876);\n+--------------------------+\n| least(6.3, 4.29, 7.6876) |\n+--------------------------+\n| 4.29 |\n+--------------------------+\nmysql> select least(\"2022-02-26 20:02:11\",\"2020-01-23 20:02:11\",\"2020-06-22 20:02:11\");\n+----------------------------------------------------------------------------+\n| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |\n+----------------------------------------------------------------------------+\n| 2020-01-23 20:02:11 |\n+----------------------------------------------------------------------------+\n")),(0,a.yg)("h3",{id:"keywords"},"keywords"),(0,a.yg)("pre",null,(0,a.yg)("code",{parentName:"pre"},"LEAST\n")))}m.isMDXComponent=!0}}]);