How MySQL Partitioning Handles NULL As shown earlier in this section, you can also verify which partitions were used for storing the rows by deleting these partitions and then performing a  SELECT . Handling of NULL with HASH and KEY partitioning.  NULL  is handled somewhat differently for tables partitioned by  HASH  or  KEY . In these cases, any partition expression that yields a  NULL  value is treated as though its return value were zero. We can verify this behavior by examining the effects on the file system of creating a table partitioned by  HASH  and populating it with a record containing appropriate values. Suppose that you have a table  th  (also in the  p  database) created using the following statement: The partitions belonging to this table can be viewed using the query shown here: TABLE_ROWS  for each partition is 0. Now insert two rows into  th  whose  c1  column values are  NULL  and 0, and verify that these rows were inserted, as shown here: Recall that for any integer  N , the value of  NULL MOD  N  is always  NULL . For tables that are partitioned by  HASH  or  KEY , this result is treated for determining the correct partition as  0 . Checking the 4685 mysql>  INSERT INTO th VALUES (NULL, ’mothra’), (0, ’gigan’); Query OK, 1 row affected (0.00 sec) mysql>  SELECT * FROM th; +------+---------+ | c1 | c2 | +------+---------+ | NULL | mothra | +------+---------+ | 0 | gigan | +------+---------+ 2 rows in set (0.01 sec) mysql> SELECT TABLE_NAME,PARTITION_NAME,TABLE_ROWS,AVG_ROW_LENGTH,DATA_LENGTH > FROM INFORMATION_SCHEMA.PARTITIONS > WHERE TABLE_SCHEMA = ’p’ AND TABLE_NAME =’th’; +------------+----------------+------------+----------------+-------------+ | TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | +------------+----------------+------------+----------------+-------------+ | th | p0 | 0 | 0 | 0 | | th | p1 | 0 | 0 | 0 | +------------+----------------+------------+----------------+-------------+ 2 rows in set (0.00 sec) mysql>  CREATE TABLE th ( -> c1 INT, -> c2 VARCHAR(20) ->  ) ->  PARTITION BY HASH(c1) ->  PARTITIONS 2; Query OK, 0 rows affected (0.00 sec) mysql>  SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH > FROM INFORMATION_SCHEMA.PARTITIONS > WHERE TABLE_SCHEMA = ’p’ AND TABLE_NAME LIKE ’ts_’; +------------+----------------+------------+----------------+-------------+ | TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | +------------+----------------+------------+----------------+-------------+ | ts2 | p0 | 0 | 0 | 0 | | ts2 | p1 | 0 | 0 | 0 | | ts2 | p2 | 0 | 0 | 0 | | ts2 | p3 | 1 | 20 | 20 | | ts3 | p0 | 0 | 0 | 0 | | ts3 | p1 | 1 | 20 | 20 | | ts3 | p2 | 0 | 0 | 0 | +------------+----------------+------------+----------------+-------------+ 7 rows in set (0.01 sec)