---
title: "What is the Stored Procedure? Create a Procedure to find the record by stu_ID from the student table"  
description: "What is the Stored Procedure? Create a Procedure to find the record by stu_ID from the student table"  
author: "Revati S Misra"  
published: 2023-03-24  
updated: 2023-04-12  
canonical: https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table  
category: "mysql"  
tags: ["database", "mysql"]  
reading_time: 2 minutes  

---

# What is the Stored Procedure? Create a Procedure to find the record by stu_ID from the student table

What is the [Stored Procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net)? Create a Procedure to find the record by stu_ID from the [student](https://www.mindstick.com/articles/157138/student-loan-default-wage-garnishment-and-student-loan) table.

## Replies

### Reply by Krishnapriya Rajeev

In SQL, a [stored](https://www.mindstick.com/forum/34641/how-to-create-a-stored-procedure-for-display-record-by-id) [procedure](https://www.mindstick.com/forum/32/stored-procedure-return-datatype) is a *pre-compiled collection of SQL statements* and procedural logic that can be executed repeatedly by invoking the procedure. Stored procedures are stored in the database and can be used to encapsulate complex business logic, improve performance, and simplify database administration.

Here's an example of how to create a stored procedure in SQL Server to find a student record by their stu_ID from the student table:

```plaintext
CREATE PROCEDURE find_student
  @stu_ID INT
AS
BEGIN
  SELECT * FROM student WHERE stu_ID = @stu_ID
END
```

In this example, the CREATE PROCEDURE statement is used to create a stored procedure called find_student. The procedure takes one input parameter, @stu_ID, which is an integer representing the student ID.

The SELECT statement is used to retrieve the student record from the student table where the stu_ID matches the input parameter @stu_ID.

To execute the stored procedure, you can use the EXECUTE statement, passing in the value of @stu_ID as a parameter:

```plaintext
EXECUTE find_student @stu_ID = 12
```

This will return the student record from the student table where the stu_ID is 12.


---

Original Source: https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
