CTH: Delete From Employee Where Id 100 : Syntax of A SQL DELETE Statement

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 5

SQL Delete Statement

The DELETE Statement is used to delete rows from a


table.

Syntax of a SQL DELETE Statement


DELETE FROM table_name [WHERE
condition];

CTH : DELETE FROM employee WHERE


id = 100;
Condition
tablename

Cth : DELETE FROM employee;


: To delete all the rows from the employee
table,

S Q L T R U N C AT E S t a t e m e n t
The SQL TRUNCATE command is used to delete all the rows from the table and free the space
containing the table.

*arahan digunakan untuk memadam semua baris daripada


jadual dan membebaskan ruang yang mengandungi jadual.

Syntax to TRUNCATE a table:


TRUNCATE TABLE table_name;

SQL SELECT INTO Examples


We can copy all columns from one table to
another, existing table:
INSERT INTOtable2
SELECT * FROMtable1;
Or we can copy only the columns we want to
into another, existing table:
INSERT INTOtable2
(column_name(s))
SELECTcolumn_name(s)
FROMtable1;

Customer

Supplier

SQL INSERT INTO SELECT Examples :


Copy only a few columns from
"Suppliers" into "Customers":
INSERT INTO Customers
(CustomerName, Country)
SELECT SupplierName, Country FROM
Suppliers;
INSERT INTO Customers
(CustomerName, Country)
SELECT SupplierName, Country FROM
Suppliers
WHERE Country='Germany';

You might also like