Skip to content
Tutorial Gateway
  • C
  • C#
  • Python
  • SQL
  • Java
  • JS
  • MySQL
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs
    • Search
MySQL SIGN Function Example 1

MySQL SIGN Function

MySQL SIGN function is one of the Numeric Functions, which is to return the sign of the specified expression. And the return value is either Positive (+1), Negative (-1), or Zero (0). The basic syntax of it is as shown below:

SELECT SIGN(Numeric_Expression)
FROM Source
  • If the Expression is Zero, it returns Zero as a result.
  • If the Numeric_Expression is a Negative Number, it returns a Negative One(-1) as a result.
  • And If the Expression is a positive number, it returns a Positive One(+1).

To demonstrate this MySQL SIGN Numeric function, we are going to use the below shown data.

Source Table 1

MySQL SIGN Function Example

This method finds and returns the sign of a specified value. The following query shows multiple ways to use this.

-- Finding for Negative Value
SELECT SIGN(-240.75) AS `SignValue`;

-- Finding for Positive Value
SELECT SIGN(125.267) AS `SignValue`;

-- Finding for Zero
SELECT SIGN(0) AS `SignValue`;

-- of string value
SELECT SIGN('125.274') AS `SignValue`;

-- Example on String
SELECT SIGN('MySQL') AS `SignValue`;

-- Example on NULLs
SELECT SIGN('NULL') AS `SignValue`;

From the screenshot below, you can see that we used it on different values.

MySQL SIGN Function Example 1

and

Example 2

The MySQL example of the Numeric method also allows you to check the value for the column data. In this example, we are going to find the sign value for all the records present in the Service Grade column.

SELECT Product, Color,
		StandardCost, Sales, TaxAmt,
        ServiceGrade,
        SIGN(ServiceGrade) AS `Grade Sign`
FROM `numeric functions`;
MySQL SIGN Function Example 3
Back To Categories MySQL
MySQL DEGREES Function
MySQL CEILING Function

Related Topics

  • MySQL Tutorial
  • How to Download MySQL?
  • Install MySQL on Windows
  • MySQL Database & Table
    • Create Database
    • Delete Database
    • Create Table
    • Drop Table
  • MySQL Basic Commands
    • INSERT Statement
    • DELETE Statement
    • SELECT Statement
    • SELECT DISTINCT Statement
    • SELECT ALIAS Column
    • SELECT LIMIT
    • TRUNCATE TABLE
  • MySQL Clauses
    • MySQL GROUP BY Clause
    • MySQL Having Clause
    • MySQL ORDER BY Clause
    • MySQL WHERE Clause
  • MySQL Operators
    • Arithmetic Operators
    • AND Operator
    • OR Operator
    • NOT Operator
    • XOR Operator
    • BETWEEN Operator
    • Not Between Operator
    • LIKE Operator
    • NOT LIKE Operator
    • IS Operator
    • IN Operator
    • NOT IN Operator
    • INTERVAL Operator
  • MySQL Working on NULLS
    • MySQL COALESCE
    • MySQL IFNULL
    • MySQL NULLIF
    • MySQL IS NULL
    • MySQL IS NOT NULL
  • MySQL Joins
    • MySQL Cross Join
    • MySQL Inner Join
    • MySQL Left Join
    • MySQL Right Join
  • MySQL Comparison Func
    • GREATEST Function
    • LEAST Function
  • MySQL Agg Functions
    • Introduction
    • AVG Function
    • BIT_AND Function
    • BIT_OR Function
    • BIT_XOR Function
    • MAX Function
    • MIN Function
    • SUM Function
    • STDDEV_POP Function
    • STDDEV_SAMP Function
    • VAR_POP Function
    • VAR_SAMP Function
  • MySQL Date Functions
    • Introduction to Date Functions
    • ADDDATE Function
    • ADDTIME Function
    • CONVERT_TZ Function
    • CURDATE Function
    • Current Date
    • CURTIME Function
    • Current Time
    • CURRENT_TIMESTAMP
    • Date Function
    • DATE_FORMAT
    • DATE_SUB Function
    • DATE_ADD Function
    • DATEDIFF Function
    • Day Function
    • DAYNAME Function
    • DAYOFYEAR Function
    • DAYOFWEEK
    • DAYOFMONTH
    • EXTRACT Function
    • FROM_UNIXTIME
    • FROM_DAYS Function
    • GET_FORMAT Function
    • LAST_DAY Function
    • LOCALTIME Function
    • LOCALTIMESTAMP
    • MAKEDATE Function
    • MAKETIME Function
    • MICROSECOND Function
    • MINUTE Function
    • MONTHNAME Function
    • MONTH Function
    • NOW Function
    • PERIOD_DIFF Function
    • PERIOD_ADD Function
    • QUARTER Function
    • SECOND Function
    • SEC_TO_TIME Function
    • STR_TO_DATE Function
    • SUBDATE Function
    • SUBTIME Function
    • SYSDATE Function
    • TIME Function
    • TIME_FORMAT Function
    • TIMEDIFF Function
    • TIMESTAMPDIFF Function
    • TIMESTAMPADD Function
    • TIMESTAMP Function
    • TIME_TO_SEC Function
    • TO_SECONDS Function
    • TO_DAYS Function
    • UNIX_TIMESTAMP Function
    • UTC_TIMESTAMP Function
    • UTC_TIME Function
    • UTC_DATE Function
    • WEEK Function
    • WEEKDAY Function
    • WEEKOFYEAR Function
    • YEARWEEK Function
    • Year Function
  • MySQL String Functions
    • Introduction to Strings
    • ASCII Function
    • BIN Function
    • BIT_LENGTH Function
    • CHAR_LENGTH Function
    • CHAR Function
    • CONCAT_WS Function
    • CONCAT Function
    • ELT Function
    • EXPORT_SET Function
    • FIELD Function
    • FIND_IN_SET Function
    • FORMAT Function
    • HEX Function
    • UNHEX Function
    • INSERT Function
    • INSRT Function
    • LCASE Function
    • LEFT Function
    • LENGTH Function
    • LOCATE Function
    • LOWER Function
    • LPAD Function
    • LTRIM Function
    • MAKE_SET Function
    • MID Function
    • OCTET_LENGTH Function
    • OCT Function
    • ORD Function
    • POSITION Function
    • QUOTE Function
    • REPLACE Function
    • REPEAT Function
    • REVERSE Function
    • RIGHT Function
    • RTRIM Function
    • RPAD Function
    • SOUNDS LIKE Function
    • SOUNDEX Function
    • STRCMP Function
    • SPACE Function
    • SUBSTRING Function
    • SUBSTRING_INDEX Function
    • SUBSTR Function
    • TRIM Function
    • UCASE Function
    • UNHEX Function
    • UPPER Function
  • MySQL Math Functions
    • Introduction to math
    • ABS Function
    • CEILING Function
    • CONV Function
    • CRC32 Function
    • DEGREES Function
    • EXP Function
    • FLOOR Function
    • LN Function
    • LOG Function
    • LOG2 Function
    • LOG10 Function
    • PI Function
    • POW Function
    • POWER Function
    • RAND Function
    • RADIANS Function
    • ROUND Function
    • SIGN Function
    • SQRT Function
    • TRUNCATE Function
  • MySQL Trigono Functions
    • SIN Function
    • ASIN Function
    • COS Function
    • ACOS Function
    • TAN Function
    • ATAN Function
    • ATAN2 Function
  • MySQL Constraints
  • MySQL Triggers
  • MySQL Ranking Functions
  • MySQL Advanced
  • MySQL Misc
  Copyright © 2023. All Rights Reserved.
Home | About | Contact | Privacy Policy