What is the equivalent of the below sql server syntax in databricks sql? there are cases where i need to execute a block of sql code on certain conditions. I know this can be achieved with spark.sql, but the problem with spark.sql() is it does not provide the number of affected columns (insert/update/delete) after the execution of dml statement.
IF EXISTS(SELECT 1 FROM table WHERE col = value)
BEGIN
DELETE FROM table WHERE col = value
END
ELSE
BEGIN
<code to run in else>
END