![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
SQL FOR SMARTIES |
#3
| ||||||||||||||||
| ||||||||||||||||
|
|
The MOD() function in various SQL products works differently. I need to update a table in SQL FOR SMARTIES. Mind helping me out? Tell me the name and release of your SQL, and the results of these function calls. MOD (12, 5) = MOD(-12, 5) = MOD (-12, -5) = MOD (12, -5) = MOD (NULL, 5) = MOD (NULL, NULL) = MOD (12, NULL) = MOD (12, 0) = MOD (-12, 0) = MOD (0, 5) = MOD (0, -5) = MOD (0, 0) = I originally found three different approaches to this problem. Answers were 2, -2, NULL, error, 3, -3, 12 and -12. I just hope that things are more consistent today. |
|
@@version | +----------------------+ 5.1.39-community-log | +----------------------+ |
|
@@sql_mode |
|
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_S PACE,ONLY_FULL_GROUP_BY,ANSI,NO_AUTO_VALUE_ON_ZERO ,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_A LL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_D IVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO _ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH |
|
MOD (12, 5) = | MOD (12, 5) | +---------------+-------------+ MOD (12, 5) = | 2 | +---------------+-------------+ |
|
MOD(-12, 5) = | MOD(-12, 5) | +---------------+-------------+ MOD(-12, 5) = | -2 | +---------------+-------------+ |
|
MOD (-12, -5) = | MOD (-12, -5) | +-----------------+---------------+ MOD (-12, -5) = | -2 | +-----------------+---------------+ |
|
MOD (12, -5) = | MOD (12, -5) | +----------------+--------------+ MOD (12, -5) = | 2 | +----------------+--------------+ |
|
MOD (NULL, 5) = | MOD (NULL, 5) | +-----------------+---------------+ MOD (NULL, 5) = | NULL | +-----------------+---------------+ |
|
MOD (NULL, NULL) = | MOD (NULL, NULL) | +--------------------+------------------+ MOD (NULL, NULL) = | NULL | +--------------------+------------------+ |
|
MOD (12, NULL) = | MOD (12, NULL) | +------------------+----------------+ MOD (12, NULL) = | NULL | +------------------+----------------+ |
|
MOD (12, 0) = | MOD (-12, 0) | +---------------+--------------+ MOD (12, 0) = | NULL | +---------------+--------------+ |
|
MOD (-12, 0) = | MOD (-12, 0) | +----------------+--------------+ MOD (-12, 0) = | NULL | +----------------+--------------+ |
|
MOD (0, 5) = | MOD (0, 5) | +--------------+------------+ MOD (0, 5) = | 0 | +--------------+------------+ |
|
MOD (0, -5) = | MOD (0, -5) | +---------------+-------------+ MOD (0, -5) = | 0 | +---------------+-------------+ |
|
MOD (0, 0) = | MOD (0, 0) | +--------------+------------+ MOD (0, 0) = | NULL | +--------------+------------+ |
#4
| |||
| |||
|
|
The MOD() function in various SQL products works differently. I need to update a table in SQL FOR SMARTIES. Mind helping me out? Tell me the name and release of your SQL, and the results of these function calls. |
|
MOD (12, 5) = 2 MOD(-12, 5) = 3 MOD (-12, -5) = -2 MOD (12, -5) = -3 MOD (NULL, 5) = Error 1890: SQL: cannot determine datatype of SQL Column: EXP_1 MOD (NULL, NULL) = Error 1890: SQL: cannot determine datatype of SQL Column: EXP_1 MOD (12, NULL) = Error 1890: SQL: cannot determine datatype of SQL Column: EXP_1 MOD (12, 0) = Error 1307: Cannot divide by 0. MOD (-12, 0) = Error 1307: Cannot divide by 0. MOD (0, 5) = 0 MOD (0, -5) = 0 MOD (0, 0) = Error 1307: Cannot divide by 0. I originally found three different approaches to this problem. Answers were 2, -2, NULL, error, 3, -3, 12 and -12. I just hope that things are more consistent today. |
#5
| |||
| |||
|
|
The MOD() function in various SQL products works differently. I need to update a table in SQL FOR SMARTIES. Mind helping me out? Tell me the name and release of your SQL, and the results of these function calls. |
#6
| |||
| |||
|
|
The MOD() function in various SQL products works differently. I need to update a table in SQL FOR SMARTIES. Mind helping me out? Tell me the name and release of your SQL, and the results of these function calls. |
#7
| |||
| |||
|
|
MOD (12, 5) = MOD(-12, 5) = MOD (-12, -5) = MOD (12, -5) = MOD (NULL, 5) = MOD (NULL, NULL) = MOD (12, NULL) = MOD (12, 0) = MOD (-12, 0) = MOD (0, 5) = MOD (0, -5) = MOD (0, 0) = |
#8
| |||
| |||
|
|
The MOD() function in various SQL products works differently. I need to update a table in SQL FOR SMARTIES. Mind helping me out? Tell me the name and release of your SQL, and the results of these function calls. MOD (12, 5) = MOD(-12, 5) = MOD (-12, -5) = MOD (12, -5) = MOD (NULL, 5) = MOD (NULL, NULL) = MOD (12, NULL) = MOD (12, 0) = MOD (-12, 0) = MOD (0, 5) = MOD (0, -5) = MOD (0, 0) = I originally found three different approaches to this problem. Answers were 2, -2, NULL, error, 3, -3, 12 and -12. I just hope that things are more consistent today. |
#9
| |||
| |||
|
| values ( 'MOD (NULL, 5) =', MOD (NULL, 5) ) SQL0206N "NULL" is not valid in the context where it is used. SQLSTATE=42703 values ( 'MOD (NULL, NULL) =', MOD (NULL, NULL) ) SQL0206N "NULL" is not valid in the context where it is used. SQLSTATE=42703 values ( 'MOD (12, NULL) =', MOD (12, NULL) ) SQL0206N "NULL" is not valid in the context where it is used. SQLSTATE=42703 |
#10
| |||
| |||
|
|
MOD (12, 5) = 2 MOD(-12, 5) = -2 MOD (-12, -5) = -2 MOD (12, -5) = 2 MOD (NULL, 5) = NULL MOD (NULL, NULL) = NULL MOD (12, NULL) = NULL MOD (12, 0) = Failure 2650 Numeric processor operand error. MOD (-12, 0) = Failure 2650 Numeric processor operand error. MOD (0, 5) = 0 MOD (0, -5) = 0 MOD (0, 0) = Failure 2650 Numeric processor operand error. |
![]() |
| Thread Tools | |
| Display Modes | |
| |