You can use subqueries in conditional statements. Rewrite the preceding subquery that removes all records of sales of business books, as shown in the next example, to check for the records before deleting them:
if exists (select title_id from titles where type = "business") begin delete salesdetail where title_id in (select title_id from titles where type = "business") end