DROP DATABASE Statement The privileges required for executing statements within  f()  need to be checked when  f()  executes. This might mean that privileges are needed for  p1()  or  p2() , depending on the execution path within  f() . Those privileges must be checked at runtime, and the user who must possess the privileges is determined by the  SQL SECURITY  values of the view  v  and the function  f() . The  DEFINER  and  SQL SECURITY  clauses for views are extensions to standard SQL. In standard SQL, views are handled using the rules for  SQL SECURITY DEFINER . The standard says that the definer of the view, which is the same as the owner of the view’s schema, gets applicable privileges on the view (for example,  SELECT ) and may grant them. MySQL has no concept of a schema “owner” , so MySQL adds a clause to identify the definer. The  DEFINER  clause is an extension where the intent is to have what the standard has; that is, a permanent record of who defined the view. This is why the default  DEFINER  value is the account of the view creator. The optional  ALGORITHM  clause is a MySQL extension to standard SQL. It affects how MySQL processes the view.  ALGORITHM  takes three values:  MERGE ,  TEMPTABLE , or  UNDEFINED . For more information, see Section 25.5.2, “View Processing Algorithms” , as well as Section 8.2.2.4, “Optimizing Derived Tables, View References, and Common Table Expressions with Merging or Materialization” . Some views are updatable. That is, you can use them in statements such as  UPDATE ,  DELETE , or  INSERT to update the contents of the underlying table. For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the underlying table. There are also certain other constructs that make a view nonupdatable. A generated column in a view is considered updatable because it is possible to assign to it. However, if such a column is updated explicitly, the only permitted value is  DEFAULT . For information about generated columns, see Section 13.1.20.8, “CREATE TABLE and Generated Columns” . The  WITH CHECK OPTION  clause can be given for an updatable view to prevent inserts or updates to rows except those for which the  WHERE  clause in the  select_statement  is true. In a  WITH CHECK OPTION  clause for an updatable view, the  LOCAL  and  CASCADED  keywords determine the scope of check testing when the view is defined in terms of another view. The  LOCAL  keyword restricts the  CHECK OPTION  only to the view being defined.  CASCADED  causes the checks for underlying views to be evaluated as well. When neither keyword is given, the default is  CASCADED . For more information about updatable views and the  WITH CHECK OPTION  clause, see Section 25.5.3, “Updatable and Insertable Views” , and Section 25.5.4, “The View WITH CHECK OPTION Clause” . 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 . When a database is dropped, privileges granted specifically for the database are not  automatically dropped. They must be dropped manually. See Section 13.7.1.6, “GRANT Statement” . 2610 Important 13.1.24 DROP DATABASE Statement IF name IS NULL then CALL p1(); ELSE CALL p2(); END IF;