DROP USER and DROP ROLE Statements in SQL
DROP USER and DROP ROLE Statements in SQL: Video Lesson
This video lesson, titled “The DROP USER and DROP ROLE Statements,” shows how to use the DROP USER and DROP ROLE statements in SQL. This video lesson is from our complete Introductory SQL course, titled “Mastering Introductory SQL Made Easy v.1.0.”
DROP USER and DROP ROLE Statements in SQL: Overview
This blog post discusses using the DROP USER and DROP ROLE statements in SQL. You can use the DROP USER statement in SQL to delete a user from the database. Note that this statement is technically classified as Data Definition Language (DDL), as it defines the objects within the database. However, it is often used in conjunction with the DCL statements. The core SQL of the DROP USER statement is shown below. Note that the “user_name” parameter is the user name of the user to delete.
DROP USER user_name
DROP USER and DROP ROLE Statements in SQL: A picture from the video lesson titled “4.6- The DROP USER and DROP ROLE Statements” showing the SQL syntax of the DROP USER statement in SQL.
You can delete existing roles within your database by using the DROP ROLE statement. Note that this statement is technically classified as Data Definition Language (DDL), as it defines the objects within the database. However, it is often used in conjunction with the DCL statements. The core SQL of the DROP ROLE statement is shown below. Note that the “role_name” parameter is the name of the role to delete.
DROP ROLE role_name
Below are hyperlinks that show documentation for the implementation of DROP USER within MySQL 5.7, SQL Server 2012 and Access 2013. You will also find documentation on the implementation of DROP ROLE within SQL Server 2012. Remember that MySQL 5.7 does not support roles in its SQL.
MySQL 5.7 (DROP USER):
https://dev.mysql.com/doc/refman/5.7/en/drop-user.html
SQL Server 2012 (DROP USER):
https://technet.microsoft.com/en-us/library/ms189438.aspx
Access 2013 (DROP USER):
https://msdn.microsoft.com/en-us/library/office/ff193192.aspx
SQL Server 2012: (DROP ROLE):