Junior — Middle
What is the role of DML operators in managing data within a database?
sobes.tech AI
Answer from AI
DML (Data Manipulation Language) operators are used to manage data within a database. They allow performing operations such as adding, modifying, deleting, and retrieving data. The main DML commands:
- INSERT — adds new records to a table.
- UPDATE — modifies existing records.
- DELETE — deletes records from a table.
- SELECT — retrieves data from tables.
Example in SQL:
INSERT INTO users (name, age) VALUES ('Ivan', 30);
UPDATE users SET age = 31 WHERE name = 'Ivan';
DELETE FROM users WHERE name = 'Ivan';
SELECT * FROM users;
Thus, DML operators enable efficient management of database contents, providing the ability to modify and retrieve data.