SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE USERS;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE jobs DROP FOREIGN KEY constraint_name
SET foreign_key_checks = 0;
ALTER TABLE table_name DROP FOREIGN KEY constraint_name
ALTER TABLE table_name
DROP FOREIGN KEY constraint_name;
Code language: SQL (Structured Query Language) (sql)
SET FOREIGN_KEY_CHECKS = 0;
drop table if exists customers;
drop table if exists orders;
drop table if exists order_details;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE COMPANY (
company_id INT NOT NULL,
company_name VARCHAR(50),
PRIMARY KEY (company_id)
) ENGINE=INNODB;
CREATE TABLE USER (
user_id INT,
user_name VARCHAR(50),
company_id INT,
INDEX company_id_idx (company_id),
FOREIGN KEY (company_id) REFERENCES COMPANY (company_id) ON...
) ENGINE=INNODB;