In this presentation, we focus on delete
and select
commands within SQL's Data Manipulation Language (DML).
SQL consists of four sublanguages:
DELETE FROM table_name WHERE condition
DELETE FROM student WHERE ID = 101;
truncate
, delete
affects the data but not the table structure.SELECT column1, column2 FROM table_name WHERE condition
SELECT * FROM table_name
SELECT * FROM student WHERE gender = 'F';
SELECT *
retrieves all columns.Delete vs. Truncate:
Truncate
is faster but does not use conditions.Delete
can be selective using conditions.Select Command:
WHERE
to filter data.update
query adjusts account balance after money is withdrawn.select
query retrieves current balance.Understanding and using delete
and select
commands are essential for manipulating data within SQL databases effectively. They allow for practical applications in real-world scenarios, notably in frontend-backend communication in systems like ATM machines.