Data cleaning: Difference between revisions

Jump to navigation Jump to search
52 bytes added ,  7 April 2015
no edit summary
No edit summary
Line 1: Line 1:


== quick table ==
== check if field value was not fulfilled  ==
=== quick table ===
<table border="1" style="width: 100%">
<table border="1" style="width: 100%">
   <tr style="background-color: #555555; color: #ffffff;">
   <tr style="background-color: #555555; color: #ffffff;">
Line 89: Line 90:
* method6: {{kbd | key = <nowiki>SELECT * FROM `my_table` WHERE (  (COALESCE(column_name, '') = '') OR (column_name NOT BETWEEN min AND max)  )</nowiki>}}
* method6: {{kbd | key = <nowiki>SELECT * FROM `my_table` WHERE (  (COALESCE(column_name, '') = '') OR (column_name NOT BETWEEN min AND max)  )</nowiki>}}


== is null ==
=== is null ===
Finds whether a variable is NULL. [http://ideone.com/tKv2gQ online demo]
Finds whether a variable is NULL. [http://ideone.com/tKv2gQ online demo]
* PHP [http://tw2.php.net/is_null is_null]
* PHP [http://tw2.php.net/is_null is_null]
Line 114: Line 115:
# Using PHP [http://php.net/manual/en/function.empty.php empty()] function to find 0, null, false, empty string, empty array values.
# Using PHP [http://php.net/manual/en/function.empty.php empty()] function to find 0, null, false, empty string, empty array values.


== check if field value was fulfilled ==
=== check if field value was fulfilled ===
length of string > 0
length of string > 0
* MySQL: {{kbd | key = SELECT * FROM table_name WHERE LENGTH(TRIM( column_name )) != 0;}} [http://sqlfiddle.com/#!9/e0e5f/1/0 demo][http://ideone.com/rt6D2A]
* MySQL: {{kbd | key = SELECT * FROM table_name WHERE LENGTH(TRIM( column_name )) != 0;}} [http://sqlfiddle.com/#!9/e0e5f/1/0 demo][http://ideone.com/rt6D2A]

Navigation menu