Professional Documents
Culture Documents
RESOURCES USED:
RESULTS:
We completed this practical successfully and inserted and deleted the
data easily without any errors.
CONCLUSION:
Now we are able to insert and delete the records in a table in the
MySql software.
Definition The delete statement is used to remove The truncate command removes the complete
single or multiple records from an existing data from an existing table but not the table
table depending on the specified itself. It preserves the table structure or schema.
condition.
Language It is a DML (Data Manipulation Language) It is a DDL (Data Definition Language) command.
command.
WHERE It can use the WHERE clause to filter any It does not use the WHERE clause to filter
specific row or data from the table. records from the table.
Permission We need to have DELETE permission to We need to have ALTER permission to use this
use this command. command.
Working This command eliminates records one by This command deletes the entire data page
one. containing the records.
Table Identity This command does not reset the table It always resets the table identity.
identity because it only deletes the data.
Transaction It maintains transaction logs for each It does not maintain transaction logs for each
deleted record. deleted data page.
Speed Its speed is slow because it maintained the Its execution is fast because it deleted entire
log. data at a time without maintaining transaction
logs.
Trigger This command can also activate the This command does not activate the triggers
trigger applied on the table and causes applied on the table to fire.
them to fire.
Space The DELETE statement occupies more The TRUNCATE statement occupies less
transaction space than truncate because it transaction space because it maintains a
maintains a log for each deleted row. transaction log for the entire data page instead
of each row.
3. Create table for employee whose attributes are emp_id, emp_name, date_of_joining,
Emp_salary, emp_dept and insert 10 rows in it.
4. Create table for student with related attributes and check the total number of records.
CREATE TABLE `student`.`student` (
`student_id` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`address` VARCHAR(45) NOT NULL,
`email_id` VARCHAR(45) NOT NULL,
PRIMARY KEY (`student_id`));