Procedure to Delete All Discontinued Products
Products Table:
DELIMITER //
This changes the delimiter temporarily so that we can define the procedure properly (since semicolons are used within the procedure).
CREATE PROCEDURE DeleteDiscontinuedProducts1()
This starts the creation of the procedure. The procedure name is DeleteDiscontinuedProducts1
, and it takes no parameters.
DELETE FROM Product1 WHERE Discontinued = 1;
This is the main query that will delete all records from the Product1
table where the Discontinued
field is set to 1.
END //
This marks the end of the procedure.
DELIMITER ;
This restores the default delimiter back to a semicolon (;
).
CALL DeleteDiscontinuedProducts1();
This statement executes the stored procedure and deletes all discontinued products from the Product1
table.
SQL Query:
DELIMITER //
CREATE PROCEDURE DeleteDiscontinuedProducts1()
BEGIN
-- Delete all products where the 'Discontinued' flag is set to 1
DELETE FROM Product1
WHERE Discontinued = 1;
END //
DELIMITER ;
-- To execute the procedure, you can run the following command:
CALL DeleteDiscontinuedProducts1();
Output:
Trainings :
Data Science Training in Indore | Data Analytics Training in Indore | Python Training in Indore | Blockchain Training in Indore | React JS Training in Indore | Web Development Training in Indore | Full Stack Development Training in Indore |Free Courses and Resource :
Verbal Aptitude | Matplotlib Tutorials | Examples | Interview Questions | Pandas Tutorials | Projects | Interview Questions | OpenCV Tutorials | Projects | Interview Questions | ExpressJS Tutorials | Projects | Interview Questions | Dart | Python Data Structures and Algorithms | Rust Tutorials | Projects | Interview Questions | Aptitude Tests | HackerRank Python | Django | MongoDB Tutorials | Examples | Interview Questions | NumPy Practice Questions | Python Tutorials by CodersDaily | Golang Tutorials | Projects | Interview Questions | React.js Tutorials | Verbal Ability Tutorial | MS Sql Server Tutorials | Examples | Interview Questions | Power BI Tutorials | Projects | Interview Questions | Example Dashboards | Numpy Tutorials | Projects | Interview Questions | Django REST Framework Tutorial | HackerRank C++ Solutions | Tensor Flow | Pandas Practice Questions | Python Practice Questions | C++ Tutorials | Quantitative Ability Tutorial | Javascript | Node.js Tutorials | HackerRank SQL Solutions | HackerRank DSA Solutions | Verbal Aptitude 2 | HackerRank Java Solutions | HTML Tutorial | TCS NQT Mock Test Series | Reasoning Ability Tutorial | CodeChef Python Solutions | HackerRank C Program Solutions | Leetcode Python Solutions | SQL Practice Question | Matplotlib Practice Questions |Interview Questions :
Pandas Tutorials | Projects | Interview Questions | ExpressJS Tutorials | Projects | Interview Questions | Django | Python Tutorials by CodersDaily | Golang Tutorials | Projects | Interview Questions | Numpy Tutorials | Projects | Interview Questions | Django REST Framework Tutorial |Top Colleges in India :
Indian Institute of Technology Bombay | Jaypee University of Engineering and Technology - Guna |