Page 86 - CITS - Computer Software Application -TT
P. 86
COMPUTER SOFTWARE APPLICATION - CITS
5 COMMENT: Used to add comments or descriptions to database objects for documentation purposes.
ON TABLE table_name IS ‘This is a table comment.’;
6 CREATE INDEX: Used to create an index on one or more columns of a table for faster data retrieval.
CREATE INDEX index_name ON table_name (column1, column2);
7 CREATE VIEW: Used to create a virtual table based on the result of a query.
CREATE VIEW view_name AS
SELECT column1, column2 FROM table_name WHERE condition;
DDL commands are typically used by database administrators and developers to design and manage the
database’s structure. They are essential for defining how data should be organized and ensuring data integrity
within a database system.
DML(Data Manipulation Language)
DML, which stands for Data Manipulation Language, is a subset of SQL (Structured Query Language) that is used
for managing and manipulating data stored in a database. DML commands allow you to perform operations on the
data itself, such as inserting, updating, and deleting records in database tables. The primary DML commands are:
1 INSERT: Used to add new rows (records) of data into a database table.
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
2 UPDATE: Used to modify existing data in a database table.
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
3 DELETE: Used to remove rows (records) from a database table based on specified criteria.
DELETE FROM table_name
WHERE condition;
DML commands are essential for maintaining and changing the data within a database. These commands enable
users and applications to insert new data, update existing data, and remove unwanted data, ensuring that the
database remains accurate and up-to-date.
DCL (Data Control Language)
DCL, which stands for Data Control Language, is a subset of SQL (Structured Query Language) used for controlling
and managing permissions and access rights within a database management system (DBMS). DCL commands
are essential for ensuring data security and access control by specifying which users or roles have the authority
to perform certain actions on database objects. The two primary DCL commands are:
1 GRANT: The GRANT command is used to give specific privileges or permissions to users or roles. These
privileges can include the ability to perform actions like SELECT, INSERT, UPDATE, DELETE, or even the
ability to create or modify database objects.
GRANT privilege_type
ON object_name
TO user_or_role;
For example, to grant SELECT permission on a table to a user:
GRANT SELECT ON table_name TO user_name;
2 REVOKE: The REVOKE command is used to remove previously granted privileges from users or roles.
REVOKE privilege_type ON object_name FROM user_or_role;
For example, to revoke SELECT permission on a table from a user:
73
CITS : IT&ITES - Computer software application - Lesson 18 - 36