title: Adding optional parameter to stored procedure ,and if i didnt pass that param then all details has to fetch
body: <p>I want to add an optional param in stored procedure and if i call that stored procedure with optional param ,respected output should be fetched and if didnt pass param value in call then it should fetch all values..</p>
  
  <p>i have already tried and student_marks should be optional, if i pass 90 as marks in param then ,the student with 90 marks in all subjects should be fetched .. if i pass only student name then the student with all subjects with marks to be fetched..</p>
  
  <pre><code>DELIMITER $$
  DROP PROCEDURE IF EXISTS students_details $$
  CREATE PROCEDURE students_details(IN name INT(11), IN marks CHAR(20))
    BEGIN 
      SELECT 
        student_name,
        student_id,
        subject_name,
        student_marks
      FROM students 
      where student_name = name (declared in param)
      and student_marks =  marks (optional param); 
  
    END $$
  DELIMITER ;
  </code></pre>
  
  <p>required output :  if i run  call students_details('john',80) ,  then the john's details has to be fetched ..(john with 80 marks in subjects)  ....</p>
  
  <p>if i run call students_details('john')  only john as first param then the output should be john's all subjects with marks ..</p>