Yes you can:
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table1;
TRUNCATE table2;
SET FOREIGN_KEY_CHECKS = 1;
With these statements, you risk letting in rows into your tables that do not adhere to the FOREIGN KEY
constraints.
More Related Contents:
- MySQL Removing Some Foreign keys
- How to remove constraints from my MySQL table?
- MySQL Error 1215: Cannot add foreign key constraint
- Mysql error 1452 – Cannot add or update a child row: a foreign key constraint fails
- MySQL foreign key constraints, cascade delete
- How do I see all foreign keys to a table or column?
- MySQL Cannot Add Foreign Key Constraint
- Required to join 2 tables with their FKs in a 3rd table
- Error Code: 1005. Can’t create table ‘…’ (errno: 150)
- Basics of Foreign Keys in MySQL?
- How do I use on delete cascade in mysql?
- Add Foreign Key to existing table
- How to change the foreign key referential action? (behavior)
- How do I add a custom CHECK constraint on a MySQL table?
- Unique constraint that allows empty values in MySQL
- How to create relationships in MySQL
- MySQL InnoDB foreign key between different databases
- Can a MySQL trigger simulate a CHECK constraint? [duplicate]
- A constraint to prevent the insert of an empty string in MySQL
- Force InnoDB to recheck foreign keys on a table/tables?
- How to add not null constraint to existing column in MySQL
- Is it possible to reference one column as multiple foreign keys?
- How to insert values in table with foreign key using MySQL?
- MySQL foreign key to allow NULL?
- Use Composite Primary Key as Foreign Key
- Foreign key constraints: When to use ON UPDATE and ON DELETE
- MySQL and Check Constraints
- List of Constraints from MySQL Database
- “General error: 1005 Can’t create table” Using Laravel Schema Build and Foreign Keys
- MySQL Relationships