Database languages in DBMS

0

 

Database languages in DBMS

Once data is stored or filled it requires manipulation like insertion, deletion, updating, and modification of data. For these operations a set of languages are provided by the database management system (DBMS). So, the database languages are used to read, update and store data in the database.


Database languages in DBMS


 Different types of DBMS languages | DDL, DML, TCL, DCL, QUERY LANGUAGE


1)  Data definition language (DDL):

 This is a language used to define the structure of a database, including the tables, fields, and relationships between data entities. Examples of DDL statements include:


CREATE TABLE:   This statement is used to create a new table in the database. For example:


CREATE TABLE employees ( employee_id INT PRIMARY KEY, first_name VARCHAR(255), last_name VARCHAR(255), hire_date DATE, salary NUMERIC(8,2) );

ALTER TABLE:    This statement is used to modify the structure of an existing table in the database. For example:


ALTER TABLE employees ADD email VARCHAR(255);

DROP TABLE:    This statement is used to delete a table from the database. For example:


DROP TABLE employees;

2)  Data manipulation language (DML): 

This is a language used to manipulate the data stored in a database, including inserting, updating, and deleting records. Examples of DML statements include:


SELECT:    This statement is used to retrieve data from the database. For example:



SELECT * FROM employees WHERE salary > 50000;

INSERT:    This statement is used to insert a new record into a table. For example:



INSERT INTO employees (employee_id, first_name, last_name, hire_date, salary) VALUES (1, 'John', 'Doe', '2022-01-01', 50000);

UPDATE:    This statement is used to modify the data in an existing record. For example:



UPDATE employees SET salary = 55000 WHERE employee_id = 1;

DELETE:    This statement is used to delete a record from a table. For example:


DELETE FROM employees WHERE employee_id = 1;

3)  Data control language (DCL):

 This is a language used to control access to the data stored in a database, including granting and revoking permissions to users and application programs. Examples of DCL statements include:


GRANT:    This statement is used to grant permissions to a user or role. For example:



GRANT SELECT, INSERT, UPDATE ON employees TO user1;

REVOKE:    This statement is used to revoke permissions from a user or role. For example:


REVOKE SELECT, INSERT, UPDATE ON employees FROM user1;

4)  Transaction control language (TCL): 

This is a language used to manage transactions in a database, including starting, committing, and rolling back transactions. Examples of TCL statements include:


BEGIN TRANSACTION:    This statement is used to start a new transaction.


COMMIT:    This statement is used to save the changes made during a transaction.


ROLLBACK:    This statement is used to undo the changes made during a transaction.


For example:



BEGIN TRANSACTION; UPDATE employees SET salary = 55000 WHERE employee_id = 1; COMMIT;


5)  Query language:

 This is a language used to retrieve specific data from a database. SQL (Structured Query Language) is the most widely-used query language DBMSs.



Database languages in DBMS | what is database languages | languages in DBMS | DBMS languages | SQL language


______________________________________



Please share this post and blog link with your friends.For more programs use this blog.


If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com


Created by-- HARSH CHAUHAN



Tags

Post a Comment

0Comments
Post a Comment (0)