Row-level Security
   HOME

TheInfoList



OR:

A data control language (DCL) is a syntax similar to a computer
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
used to control access to data stored in a database (
authorization Authorization or authorisation (see American and British English spelling differences#-ise, -ize (-isation, -ization), spelling differences), in information security, computer security and identity management, IAM (Identity and Access Managemen ...
). In particular, it is a component of Structured Query Language (SQL). Data Control Language is one of the logical group in SQL Commands
SQL
is the standard language for relational database management systems. SQL statements are used to perform tasks such as insert data to a database, delete or update data in a database, or retrieve data from a database. Though database systems use SQL, they also have their own additional proprietary extensions that are usually only used on their system. For example, Microsoft SQL server uses Transact-SQL (T-SQL), which is an extension of SQL. Similarly, Oracle uses PL-SQL, which an Oracle-specific SQL extension. However, the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database. Examples of DCL commands include the SQL commands: * GRANT to allow specified users to perform specified tasks. * REVOKE to remove the user accessibility to
database object A database object is a structure for storing, Database administrator, managing and presenting application- or user-specific data in a database. Depending on the database management system (DBMS), many different types of database objects can exist. ...
. The operations for which privileges may be granted to or revoked from a user or role apply to both the
Data definition language In the context of SQL, data definition or data description language (DDL) is a syntax for creating and modifying database objects such as tables, indices, and users. DDL statements are similar to a computer programming language for defining d ...
(DDL) and the
Data manipulation language A data manipulation language (DML) is a computer programming language used for adding (inserting), deleting, and modifying (updating) data in a database. A DML is often a sublanguage of a broader database language such as SQL, with the DML com ...
(DML), and may include CONNECT, SELECT,
INSERT An SQL INSERT statement adds one or more records to any single table in a relational database. Basic form Insert statements have the following form: The number of columns and values must be the same. If a column is not specified, the default va ...
, UPDATE, DELETE,
EXECUTE Execution, in capital punishment Capital punishment, also known as the death penalty and formerly called judicial homicide, is the state-sanctioned killing of a person as punishment for actual or supposed misconduct. The sentence (law), s ...
, and
USAGE The usage of a language is the ways in which its written and spoken variations are routinely employed by its speakers; that is, it refers to "the collective habits of a language's native speakers", as opposed to idealized models of how a languag ...
.


Microsoft SQL Server

In
Microsoft SQL Server Microsoft SQL Server is a proprietary relational database management system developed by Microsoft using Structured Query Language (SQL, often pronounced "sequel"). As a database server, it is a software product with the primary function of ...
there are four groups of SQL commands: * Data Manipulation Language (DML) * Data Definition Language (DDL) * Data Control Language (DCL) * Transaction Control Language (TCL) DCL commands are used for access control and permission management for users in the database. With them we can easily allow or deny some actions for users on the tables or records (row level security). DCL commands are: ;GRANT: gives specified permissions for the table (and other objects) to, or assigns a specified role with certain permissions to, specified groups or users of a database; ;REVOKE: takes away specified permissions for the table (and other objects) to, or takes away a specified role with certain permissions to, specified groups or users of a database; ;DENY: denies a specified permission to a security object. For example: GRANT can be used to give privileges to user to do SELECT, INSERT, UPDATE and DELETE on a specific table or multiple tables. The REVOKE command is used to take a privilege away (default) or revoking specific command like UPDATE or DELETE based on requirements.


Example

In the first example, GRANT gives privileges to user User1 to do SELECT, INSERT, UPDATE and DELETE on the table named Employees. In the second example, REVOKE removes User1's privileges to use the INSERT command on the table Employees. DENY is a specific command. We can conclude that every user has a list of privilege which is denied or granted so command DENY is there to explicitly ban you some privileges on the database objects.:


Oracle Database

Oracle Database Oracle Database (commonly referred to as Oracle DBMS, Oracle Autonomous Database, or simply as Oracle) is a proprietary multi-model database management system produced and marketed by Oracle Corporation. It is a database commonly used for ru ...
divide SQL commands to different types. They are. * Data Definition Language (DDL) Statements * Data Manipulation Language (DML) Statements * Transaction Control Statements * Session Control Statements * System Control Statement * Embedded SQL Statements For details refe
Oracle-
https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_1001.htm#SQLRF30001 TCL]          Data definition language (DDL) statements let you to perform these tasks: * Create, alter, and drop schema objects * Grant and revoke privileges and roles * Analyze information on a table, index, or cluster * Establish auditing options * Add comments to the data dictionary So Oracle Database DDL commands include the Grant and revoke privileges which is actually part of Data control Language in Microsoft SQL server. Syntax for grant and revoke in Oracle Database:


Example


Transaction Control Statements in Oracle

Transaction control statements manage changes made by DML statements. The transaction control statements are: * COMMIT * ROLLBACK * SAVEPOINT * SET TRANSACTION * SET CONSTRAINT


MySQL

MySQL MySQL () is an Open-source software, open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A rel ...
server they divide SQL statements into different type of statement * Data Definition Statements * Data Manipulation Statements * Transactional and Locking Statements * Replication Statements * Prepared Statements * Compound Statement Syntax * Database Administration Statements * Utility Statements For details refe
MySQL Transactional statements
The grant, revoke syntax are as part of Database administration statementsàAccount Management System. The GRANT statement enables system administrators to grant privileges and roles, which can be granted to user accounts and roles. These syntax restrictions apply: * GRANT cannot mix granting both privileges and roles in the same statement. A given GRANT statement must grant either privileges or roles. * The ON clause distinguishes whether the statement grants privileges or roles: * With ON, the statement grants privileges * Without ON, the statement grants roles. * It is permitted to assign both privileges and roles to an account, but you must use separate GRANT statements, each with syntax appropriate to what is to be granted. The REVOKE statement enables system administrators to revoke privileges and roles, which can be revoked from user accounts and roles.


Examples

In
PostgreSQL PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
, executing DCL is transactional, and can be rolled back. Grant and Revoke are the SQL commands are used to control the privileges given to the users in a Databases
SQLite SQLite ( "S-Q-L-ite", "sequel-ite") is a free and open-source relational database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it ...
does not have any DCL commands as it does not have usernames or logins. Instead, SQLite depends on
file-system permissions Typically, a file system maintains permission settings for each stored item commonly computer file, files and directory (computer), directories that either grant or deny the ability to manipulate file system items. Often the settings allow cont ...
to define who can open and access a database.Kreibich, J.A., 2010
Using SQLite
O’Reilly.


See also

*
Data definition language In the context of SQL, data definition or data description language (DDL) is a syntax for creating and modifying database objects such as tables, indices, and users. DDL statements are similar to a computer programming language for defining d ...
*
Data manipulation language A data manipulation language (DML) is a computer programming language used for adding (inserting), deleting, and modifying (updating) data in a database. A DML is often a sublanguage of a broader database language such as SQL, with the DML com ...
*
Data query language Data query language (DQL) is part of the base grouping of SQL sub-languages. These sub-languages are mainly categorized into four categories: a data query language (DQL), a data definition language (DDL), a data control language (DCL), and a ...


References

{{Databases Data modeling SQL Database management systems