0d: 00h: 00m: 00s

🎁 Get 3 extra months of learning — completely FREE

That's 90 extra days to master new skills, build more projects, and land your dream job.

Become a PRO
Background Image

🎁 Get 3 extra months of learning completely FREE

Become a PRO
Julia
PRO
last month
Juliacountry asked

Is it same to use "*" and "ALL TABLES" when writing a GRANT/REVOKE clause?

Abhay Jajodia
Expert
2 days ago
Abhay Jajodia answered

Hi there! This is a great question and it's quite common for SQL learners to wonder about these nuances.

When writing a GRANT or REVOKE clause, the use of * and ALL TABLES might seem similar because they both refer to permissions applied to all tables within a database. However, depending on the SQL database system you are using, they might function slightly differently and could have different levels of compatibility and specificity.

- ***:** This is sometimes used as shorthand to represent operations across all tables in a database, but it heavily depends on the SQL database implementation you're dealing with. It's often more associated with selecting all columns in a SELECT statement than granting permissions. - **ALL TABLES:** This statement is very clear in intent, explicitly specifying that the action should apply to all tables. It's generally more explicit and more reliably interpreted across different SQL systems for data control operations.

Given this, ALL TABLES is the more universally accepted syntax for granting/revoking permissions across all tables in most SQL systems, which provides less ambiguity in cross-database usage.

Please, let me know if you have any further questions or if you'd like to see more examples. Hope this helps!

SQL
This question was asked as part of the Learn SQL Basics course.