{"id":122,"date":"2026-03-06T09:52:09","date_gmt":"2026-03-06T09:52:09","guid":{"rendered":"https:\/\/gigz.pk\/sql\/?post_type=lesson&#038;p=122"},"modified":"2026-03-16T18:56:27","modified_gmt":"2026-03-16T18:56:27","slug":"grant-revoke","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/","title":{"rendered":"GRANT &amp; REVOKE"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In database systems, controlling access to data is crucial for security and proper management. The <strong>GRANT<\/strong> and <strong>REVOKE<\/strong> commands allow administrators to give or remove permissions to users or roles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Learning Objectives:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Understand what GRANT and REVOKE commands do.<\/li>\n\n\n\n<li>Learn how to assign permissions to users.<\/li>\n\n\n\n<li>Learn how to remove permissions safely.<\/li>\n\n\n\n<li>Apply these commands in practical database scenarios.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Module 2: GRANT Command<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>GRANT<\/strong> command is used to give privileges to users or roles. Privileges define what actions a user can perform on database objects such as tables, views, or procedures.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GRANT privilege_list<br>ON object_name<br>TO user_name<br>[WITH GRANT OPTION];<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>privilege_list<\/code> \u2013 The type of permission (SELECT, INSERT, UPDATE, DELETE, etc.)<\/li>\n\n\n\n<li><code>object_name<\/code> \u2013 The database object on which the permission is granted<\/li>\n\n\n\n<li><code>user_name<\/code> \u2013 The user or role receiving the permission<\/li>\n\n\n\n<li><code>WITH GRANT OPTION<\/code> \u2013 Allows the user to grant the same permission to others<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GRANT SELECT, INSERT<br>ON Employees<br>TO John;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This allows John to view and add data to the Employees table.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Module 3: REVOKE Command<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>REVOKE<\/strong> command removes previously granted permissions from a user or role.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">REVOKE privilege_list<br>ON object_name<br>FROM user_name;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>privilege_list<\/code> \u2013 The permissions to remove<\/li>\n\n\n\n<li><code>object_name<\/code> \u2013 The database object from which permissions are revoked<\/li>\n\n\n\n<li><code>user_name<\/code> \u2013 The user or role losing the permission<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">REVOKE INSERT<br>ON Employees<br>FROM John;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This removes John&#8217;s ability to add data to the Employees table but does not affect his ability to view data.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Module 4: Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always follow the principle of least privilege \u2013 only grant the permissions necessary.<\/li>\n\n\n\n<li>Use roles to manage permissions more efficiently.<\/li>\n\n\n\n<li>Regularly review and revoke unnecessary permissions to maintain security.<\/li>\n\n\n\n<li>Document all GRANT and REVOKE actions for audit purposes.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Module 5: Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>GRANT<\/strong> \u2013 Assigns permissions to users or roles.<\/li>\n\n\n\n<li><strong>REVOKE<\/strong> \u2013 Removes permissions from users or roles.<\/li>\n\n\n\n<li>Proper use of these commands ensures database security and controlled access.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/sql\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Learn Advanced SQL &#038; Database Engineering (SQL-301) > Security &#038; Roles > GRANT &#038; REVOKE<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773635210534\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":66,"template":"","class_list":["post-122","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GRANT &amp; REVOKE - SQL Learning Hub<\/title>\n<meta name=\"description\" content=\"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GRANT &amp; REVOKE - SQL Learning Hub\" \/>\n<meta property=\"og:description\" content=\"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Learning Hub\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-16T18:56:27+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/grant-revoke\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/grant-revoke\\\/\",\"name\":\"GRANT &amp; REVOKE - SQL Learning Hub\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\"},\"datePublished\":\"2026-03-06T09:52:09+00:00\",\"dateModified\":\"2026-03-16T18:56:27+00:00\",\"description\":\"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/grant-revoke\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/grant-revoke\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/grant-revoke\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn Advanced SQL & Database Engineering (SQL-301) > Security & Roles > GRANT & REVOKE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/\",\"name\":\"SQL Learning Hub\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GRANT &amp; REVOKE - SQL Learning Hub","description":"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/","og_locale":"en_US","og_type":"article","og_title":"GRANT &amp; REVOKE - SQL Learning Hub","og_description":"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.","og_url":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/","og_site_name":"SQL Learning Hub","article_modified_time":"2026-03-16T18:56:27+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/","url":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/","name":"GRANT &amp; REVOKE - SQL Learning Hub","isPartOf":{"@id":"https:\/\/gigz.pk\/sql\/#website"},"datePublished":"2026-03-06T09:52:09+00:00","dateModified":"2026-03-16T18:56:27+00:00","description":"Learn SQL GRANT and REVOKE commands to manage database permissions, control user access, and improve SQL database security easily.","breadcrumb":{"@id":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/sql\/lesson\/grant-revoke\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/sql\/"},{"@type":"ListItem","position":2,"name":"Learn Advanced SQL & Database Engineering (SQL-301) > Security & Roles > GRANT & REVOKE"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/sql\/#website","url":"https:\/\/gigz.pk\/sql\/","name":"SQL Learning Hub","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/sql\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/lesson\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/media?parent=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}