MySQL Stored Procedure Example - INSERT INTO SELECT
Open your SQL Query Editor then copy & paste the below code to make a Stored Procedure to insert some data from another table using MySQL INSERT INTO SELECT Sub-Query:
delimiter | CREATE PROCEDURE SP_INSERT_INTO_SELECT( ) BEGIN INSERT INTO test(TestName) SELECT FirstName FROM employees WHERE EmployeeID >102; END; |
MySQL Stored Procedure Example - INSERT INTO SELECT - SQL Query Editor Output
Again open your SQL Query Editor then copy & paste the below code to execute the Stored Procedure to get the desired result:
CALL SP_INSERT_INTO_SELECT;
MySQL Stored Procedure Example - Executing Stored Procedure - SQL Query Editor Output
Related Tutorial Examples
- MySQL Stored Procedure Function: Making hello world Function using aliase Example
- Operator precedence in SQL Command MySQL Example
- Arithmetic operators in SQL Command MySQL Example
- Describe Table Structure using SQL Command MySQL Example
- MySQL TRUNCATE TABLE Example
- PHP String Function Example: implode() - returns formated string on the fly from an array
- Google Maps Static API Example Class Using PHP
- Regular Expression Example: Email Address Validation Using PHP
- 20 steps to make CakePHP Blog Project
- PERL Example: Use of Multidimentional Array in PERL


No comments:
Post a Comment
leave your comments here..