Middle
Clarification: search by contract number, not by ID
sobes.tech AI
Answer from AI
When implementing a search by contract number rather than by ID, it is important to consider that the contract number is a business attribute that may not be unique or may have a specific format.
When designing the search, you should:
- Ensure that the contract number is indexed in the database for fast searching.
- Handle possible variations in the number format (e.g., with spaces, dashes).
- Provide a check for uniqueness or return a list of all matches if the numbers are not unique.
Example SQL query for searching by contract number:
SELECT * FROM contracts WHERE contract_number = 'ABC-12345';
If the contract number can contain different formats, you can use the LIKE operator or regular expressions.