I am writing a procedure for selecting records from a table.
For example, the Resume table with the following fields: "city", "category", "creation date", "name", "minimum wage" ...
I transfer all these values ββto the procedure. Here is a sketch
CREATE PROCEDURE FindResumes @city varchar(20), @category varchar(20), @date varchar(20), @name varchar(20), @minSalary double BEGIN SELECT * FROM Resumes WHERE city = @city AND date = @date AND name = @name AND salary > @minSalary AND category = @category END But this is the wrong code, because not all arguments will be filled. For example, I will search only by city and category , and all other arguments will be null and of course such code will select records whose fields are null , but I need the search to be carried out only by the arguments that I specify, and did not pay empty attention .
Yes, you can do many procedures for all combinations of these arguments, but this is not a solution. Please tell me how to solve my problem?