github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/ddl/desc_table_with_foreign_key.sql (about)

     1  drop database if exists db1;
     2  create database db1;
     3  use db1;
     4  drop table if exists tb_empt6;
     5  drop table if exists tb_dept1;
     6  CREATE TABLE tb_dept1(id INT(11) PRIMARY KEY, name VARCHAR(22) NOT NULL,location VARCHAR(50) );
     7  CREATE TABLE tb_emp6 (id INT(11) PRIMARY KEY,name VARCHAR(25),deptId INT(11),salary FLOAT,CONSTRAINT fk_emp_dept1 FOREIGN KEY(deptId) REFERENCES tb_dept1(id) );
     8  desc tb_emp6;
     9  show create table tb_emp6;
    10  
    11  drop database if exists db2;
    12  create database db2;
    13  use db2;
    14  drop table if exists t1;
    15  drop table if exists t2;
    16  create table t1(a int primary key, b varchar(5));
    17  create table t2(a int ,b varchar(5), c int, constraint `c1` foreign key(c) references t1(a));
    18  desc t2;
    19  show create table t2;