Αποτελέσματα Αναζήτησης
22 Φεβ 2017 · Using Exists statement to delete data from table: IF EXISTS(SELECT 1 FROM Your_table WHERE user_id = user_id) BEGIN DELETE FROM Your_table WHERE user_id= user_id END Delete table from database : IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'TheSchema' AND TABLE_NAME = 'TheTable') BEGIN --Your delete statement END
DROP FUNCTION [IF EXISTS] function_name; Code language: SQL (Structured Query Language) (sql) In this syntax, you specify the name of the stored function that you want to drop after the DROP FUNCTION keywords. The IF EXISTS option allows you to conditionally drop a stored function if it exists.
10 Οκτ 2011 · I would test the table exists first, by running a query such as; SHOW TABLES LIKE 'table1'; And then perform the delete based on the results of that query. If the table exists, a single record is returned containing the table name.
The MySQL DROP DATABASE Statement. The DROP DATABASE statement is used to drop an existing SQL database. Syntax. DROP DATABASE databasename; Note: Be careful before dropping a database. Deleting a database will result in loss of complete information stored in the database! DROP DATABASE Example.
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name. DROP DATABASE drops all tables in the database and deletes the database. Be very careful with this statement! To use DROP DATABASE, you need the DROP privilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.
3 Ιαν 2023 · Basic Usage of the EXISTS Operator in MySQL. The EXISTS condition in MySQL is generally used along with a subquery that consists of a condition to be met. If this condition is met, then the subquery returns a minimum of one row. This method can be used to DELETE, SELECT, INSERT, or UPDATE a statement.
12 Ιαν 2011 · use the following function: DELIMITER $$ DROP FUNCTION IF EXISTS f_exists_procedure;$$ CREATE FUNCTION f_exists_procedure(in_name VARCHAR(255)) RETURNS BIT DETERMINISTIC BEGIN SELECT COUNT(1) INTO @f_result FROM information_schema.ROUTINES as info WHERE info.ROUTINE_SCHEMA = DATABASE() AND info.ROUTINE_TYPE = 'PROCEDURE' AND info.ROUTINE_NAME ...