Copy of Snippet "New Snippet 1"

dbms

CREATE TABLE employees(
employee_id int Not NULL PRIMARY KEY, first_name varchar(25) Not NULL,
last_name varchar(25) Not NULL,
email varchar(25) Not NULL,
phone_number varchar(20) Not NULL, hire_date date Not Null,
job_id varchar(10) ,
salary decimal(8,2) Not NULL, commission_pct int,
manager_id int,
department_id int
);
show columns from employees;


//



DELIMITER //
CREATE TRIGGER product_availability AFTER INSERT on products FOR EACH ROW BEGIN 
IF NEW.availability='LOCAL' THEN
INSERT INTO products_to_stores(product_id,store_id) VALUES(new.product_id,1); 
ELSE
INSERT INTO products_to_stores(product_id,store_id) 
VALUES(new.product_id,1),(NEW.product_id,2); END IF; 
END // DELIMITER ;