Assignment Triggers
Assignment Triggers
Assignment Triggers
sec)
Connection id: 10
BEFORE INSERT
MariaDB [nividb]> CREATE TABLE school (
-> );
-> BEGIN
-> END;
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to
your MariaDB server version for the right syntax to use near 'SELECT * FROM school' at line 2
+ + + + +
+ + + + +
+ + + + +
AFTER INSERT
MariaDB [nividb]> CREATE TABLE teachers(
-> );
-> BEGIN
-> END $$
-> VALUES
+ + + + +
+ + + + +
+ + + + +
+ + + +
| id | teacherId | message |
+ + + +
+ + + +
BEFORE DELETE
-> );
-> VALUES
Warnings: 0
-> );
-> BEGIN
-> END$$
+ + + + + +
+ + + + + +
+ + + + + +
(0.004 sec)
MariaDB [nividb]> SELECT * FROM teacherdetails;
+ + + + + +
+ + + + + +
+ + + + + +
AFTER DELETE
-> );
-> VALUES
-> (1002,5000),
-> (1056,7000),
-> (1076,8000);
Warnings: 0
MariaDB [nividb]> DROP TABLE IF EXISTS
(0.001 sec)
-> );
+ +
| total |
+ +
| 20000.00 |
+ +
+ +
| total |
+ +
| 15000.00 |
+ +
+ +
| total |
+ +
| 0.00 |
+ +
BEFORE UPDATE
MariaDB [nividb]> CREATE TABLE sales(
-> );
Warnings: 0
+ + + + + +
+ + + + + +
+ + + + + +
-> BEGIN
-> NEW.quantity,
-> ' cannot be 3 times greater than the current quantity ',
-> OLD.quantity);
->
-> END IF
-> END //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to
your MariaDB server version for the right syntax to use near 'END' at line 15
-> BEGIN
-> NEW.quantity,
-> ' cannot be 3 times greater than the current quantity ',
-> OLD.quantity);
-> END //
+ + + + + +
+ + + + + +
ERROR 1644 (45000): The new quantity 500 cannot be 3 times greater than the current quantity 150
AFTER UPDATE
MariaDB [ddukkdb]> CREATE TABLE prod_details(id INT PRIMARY KEY AUTO_INCREMENT,name
VARCHAR(100),quantity INT(10));
Warnings: 0
+ + + +
| id | name | quantity |
+ + + +
| 1 | Face wash | 23 |
| 2 | Face mask | 39 |
| 3 | Hair shampoo | 29 |
| 4 | Hair Gel | 53 |
+ + + +
-> BEGIN
-> END //
+ + + +
| id | name | quantity |
+ + + +
| 1 | Face wash | 30 |
| 2 | Face mask | 39 |
| 3 | Hair shampoo | 29 |
| 4 | Hair Gel | 53 |
+ + + +
+ + + + + +
+ + + + + +
| 1| 1 | 23 | 30 | 2023-10-10 12:40:32 |
+ + + + + +
+ + + + + +
+ + + + + +
| 1| 1 | 23 | 30 | 2023-10-10 12:40:32 |
| 2| 4 | 53 | 90 | 2023-10-10 12:41:22 |
+ + + + + +