Examples (DDL) that implement foreign key constraints in MySQL

xiaoxiao2021-03-06  41

# --------------------------------------- # Host: Localhost # port: 3306 # database : chho

SET FOREIGN_KEY_CHECKS = 0;

DROP DATABASE IF EXISTS `Chho`;

Create Database `Chho`;

Use `chho`;

## Structure for the `Power_Person` Table: #

CREATE TABLE `power_person` (` POWER_USER_ID` varchar (255) NOT NULL default '', `POWER_USER_LEVEL` int (11) default NULL,` POWER_OTHER` varchar (255) default NULL, PRIMARY KEY ( `POWER_USER_ID`), KEY` FK38F5D2E586CA74B5 `(` Power_user_id`) ENGINE = Myisam Default Charset = latin1;

## Structure for the `Person` Table: #

Create Table `Person` (` USER_ID` VARCHAR (255) Not null default ', `Name` VARCHAR (16) Not null default',` Password` VARCHAR (16) Not null default ', Primary Key (`User_ID `)) ENGINE = Myisam Default Charset = latin1;

## structure for the `Guest_Person` Table: #

转载请注明原文地址:https://www.9cbs.com/read-71982.html

New Post(0)