What is the difference between SEARCH and SEARCH ALL?
-
SEARCH - is a binarysearch. : SEARCH ALL - is serial search & the table must be sorted
-
SEARCH - is a serial search : SEARCH ALL - is binary search & the table must be sorted
-
Both are binary search
-
SEARCH - is a binarysearch & the table is unsorted : SEARCH ALL - is serial search
SEARCH is a serial (linear) search that examines table elements sequentially. SEARCH ALL implements a binary search algorithm, which requires the table to be sorted in ascending or descending order. Binary search is much faster for large tables but has the sorting prerequisite.
SEARCH performs a serial (linear) search through a table, checking each element in order and working on unsorted or sorted data alike. SEARCH ALL, by contrast, performs a binary search, which requires the table to be sorted (typically declared with an ASCENDING/DESCENDING KEY clause) since binary search relies on comparing against a midpoint and narrowing the range.