create if not exists mysql code example
Example 1: not exists mysql
SELECT DISTINCT store_type FROM stores
WHERE NOT EXISTS (SELECT * FROM cities_stores
WHERE cities_stores.store_type = stores.store_type);
Example 2: mysql insert if not exists
INSERT IGNORE INTO companies
(id, full_name, address, phone_number)
VALUES
(1, 'Apple', '1 Infinite Loop, Cupertino, California', 18002752273);