Home  >  Article  >  Database  >  What should navicat set the engine to before establishing foreign keys?

What should navicat set the engine to before establishing foreign keys?

下次还敢
下次还敢Original
2024-04-24 00:30:20916browse

Before foreign key constraints, table engine setting guidelines involving foreign key columns: Select an engine that supports foreign keys (InnoDB or TokuDB). Right-click the table on which you want to set the engine. Select "Table Options" and switch to the "Storage Engine" tab. Select an engine that supports foreign keys from the drop-down list. Apply changes.

What should navicat set the engine to before establishing foreign keys?

Navicat engine settings before establishing foreign keys

Before establishing foreign key constraints in Navicat, you need to The storage engine of the table where the foreign key column is located is set to an engine that supports foreign keys.

Engine that supports foreign keys

  • InnoDB
  • MariaDB’s TokuDB

Setting up the engine

  1. Right click on the table where you want to set the engine.
  2. Select Table Options.
  3. Switch to the Storage Engine tab.
  4. Select InnoDB or TokuDB from the drop-down list.
  5. Apply changes.

Note:

  • You cannot set a column in a MyISAM table as a primary key or foreign key.
  • The engine that converts tables may take some time, especially for large tables.

Example

To set the column customer_id in table customer as the primary key, and then use To create a foreign key for column customer_id in table order, you need to first set the storage engine of the two tables to InnoDB:

  • is customer Table Setup Engine: Right-click customer Table> Table Options> Storage Engine> InnoDB
  • Setup engine for order table: Right-clickorder Table> Table Options> Storage Engine> InnoDB

The above is the detailed content of What should navicat set the engine to before establishing foreign keys?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn