Using If else conditional statement on where condition mysql
Using if / else on the mysql would be much easier to express with simple query. Her we go:
Assume you have the following table:
+--------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+----------------+ | file_id | int(11) | NO | PRI | NULL | auto_increment | | file_path | text | NO | | NULL | | | file_name | varchar(120) | NO | MUL | NULL | | | file_size | bigint(20) | YES | | NULL | | | file_content | text | NO | MUL | NULL | | +--------------+--------------+------+-----+---------+----------------+
Then you want to collect records either by file_id or by file_size based on the file_size, if the file size above some value, check the name of the file to contain xls, otherwise, consider only files that have file id more than y
select * from file where if (file_size > x, file_name like '%.xls', file_id > y)
YUP!
See how you would solve these known algorithm problems
Kadane’s algorithm in C – Dynamic ProgrammingImplement Queue Using two Stacks – JavaScript algorithm
testing k complementary pairs algorithm with junit
Find longest palindrom from sequence of characters
Implementing tokenizer and adding tokens to the linked list
Changing decimal number to its binary equivalent
Check if there are three numbers a, b, c giving a total T from array A
Get maximum occurring character
Find the pairs that makes K Complementary in the given array java solution
Find K Complementary numbers from array Java implementation