{"id":7107,"date":"2018-08-30T09:04:37","date_gmt":"2018-08-30T16:04:37","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=7107"},"modified":"2023-10-24T18:51:58","modified_gmt":"2023-10-25T01:51:58","slug":"mysql-math-functions","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/","title":{"rendered":"MySQL Math Functions"},"content":{"rendered":"\n<p>This page explores the most frequently used MySQL math functions with practical &amp; real-world examples. <input id=\"search\" class=\"light-table-filter\" type=\"text\" placeholder=\"Type a function name to search...\" data-table=\"functions\"><\/input><\/p>\n\n\n\n<figure class=\"wp-block-table responsive functions\"><table><thead><tr><th>Name<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-abs\/\">ABS()<\/a><\/td><td>Returns the absolute value of a number<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-ceil\/\">CEIL()<\/a><\/td><td>Returns the smallest integer value greater than or equal to the input number (n).<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-floor\/\">FLOOR()<\/a><\/td><td>Returns the largest integer value not greater than the argument<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-mod\/\">MOD()<\/a><\/td><td>Returns the remainder of a number divided by another<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-round\/\">ROUND()<\/a><\/td><td>Rounds a number to a specified number of decimal places.<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-truncate\/\">TRUNCATE()<\/a><\/td><td>Truncates a number to a specified number of decimal places<\/td><\/tr><tr><td>ACOS(n)<\/td><td>Returns the arc cosine of n or null if n is not in the range -1 and 1.<\/td><\/tr><tr><td>ASIN(n)<\/td><td>Returns the arcsine of n which is the value whose sine is n. It returns null if n is not in the range -1 to 1.<\/td><\/tr><tr><td>ATAN()<\/td><td>Returns the arctangent of n.<\/td><\/tr><tr><td>ATAN2(n,m),&nbsp;ATAN(m,n)<\/td><td>Returns the arctangent of the two variables n and m<\/td><\/tr><tr><td>CONV(n,from_base,to_base)<\/td><td>Converts a number between different number bases<\/td><\/tr><tr><td>COS(n)<\/td><td>Returns the cosine of n, where n is in radians<\/td><\/tr><tr><td>COT(n)<\/td><td>Returns the cotangent of n.<\/td><\/tr><tr><td>CRC32()<\/td><td>Computes a cyclic redundancy check value and returns a 32-bit unsigned value<\/td><\/tr><tr><td>DEGREES(n)<\/td><td>Converts radians to degrees of the argument n<\/td><\/tr><tr><td>EXP(n)<\/td><td>Raises to the power of e raised to the power of n<\/td><\/tr><tr><td>LN(n)<\/td><td>Returns the natural logarithm of n<\/td><\/tr><tr><td>LOG(n)<\/td><td>Returns the natural logarithm of the first argument<\/td><\/tr><tr><td>LOG10()<\/td><td>Returns the base-10 logarithm of the argument<\/td><\/tr><tr><td>LOG2()<\/td><td>Returns the base-2 logarithm of the argument<\/td><\/tr><tr><td>PI()<\/td><td>Returns the value of PI<\/td><\/tr><tr><td>POW()<\/td><td>Returns the argument raised to the specified power<\/td><\/tr><tr><td>POWER()<\/td><td>Returns the argument raised to the specified power<\/td><\/tr><tr><td>RADIANS()<\/td><td>Returns argument converted to radians<\/td><\/tr><tr><td><a href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/mysql-rand\/\">RAND()<\/a><\/td><td>Returns a random floating-point value between 0 and 1.<\/td><\/tr><tr><td>SIGN(n)<\/td><td>Returns the sign of n that can be -1, 0, or 1 depending on whether n is negative, zero, or positive.<\/td><\/tr><tr><td>SIN(n)<\/td><td>Returns the sine of n<\/td><\/tr><tr><td>SQRT(n)<\/td><td>Returns the square root of n<\/td><\/tr><tr><td>TAN(n)<\/td><td>Returns the tangent of n<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>This page explores the most frequently used MySQL mathematical functions with practical &#038; real world examples.<\/p>\n","protected":false},"author":2,"featured_media":10067,"parent":0,"menu_order":21,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7107","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Math Functions<\/title>\n<meta name=\"description\" content=\"This page explores the most frequently used MySQL math functions with practical &amp; real-world examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Math Functions\" \/>\n<meta property=\"og:description\" content=\"This page explores the most frequently used MySQL math functions with practical &amp; real-world examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-25T01:51:58+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/\",\"name\":\"MySQL Math Functions\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-math-functions.svg\",\"datePublished\":\"2018-08-30T16:04:37+00:00\",\"dateModified\":\"2023-10-25T01:51:58+00:00\",\"description\":\"This page explores the most frequently used MySQL math functions with practical & real-world examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-math-functions.svg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-math-functions.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-math-functions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Math Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Math Functions","description":"This page explores the most frequently used MySQL math functions with practical & real-world examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Math Functions","og_description":"This page explores the most frequently used MySQL math functions with practical & real-world examples.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-10-25T01:51:58+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/","url":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/","name":"MySQL Math Functions","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-math-functions.svg","datePublished":"2018-08-30T16:04:37+00:00","dateModified":"2023-10-25T01:51:58+00:00","description":"This page explores the most frequently used MySQL math functions with practical & real-world examples.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-math-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-math-functions.svg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-math-functions.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-math-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Math Functions"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=7107"}],"version-history":[{"count":3,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7107\/revisions"}],"predecessor-version":[{"id":11669,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7107\/revisions\/11669"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media\/10067"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=7107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}