MariaDB [test]> CREATE TABLE `B2C_S_USER` (
|
-> `ROW_ID` varchar(15) NOT NULL,
|
-> `LOGIN` varchar(50) NOT NULL,
|
-> `CDC_INSERT_TIME` datetime DEFAULT sysdate(),
|
-> `CDC_UPDATE_TIME` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
-> `op_ts` datetime DEFAULT NULL,
|
-> UNIQUE KEY `B2C_S_USER_P1` (`ROW_ID`),
|
-> KEY `B2C_S_USER_M1` (`LOGIN`)
|
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
Query OK, 0 rows affected (0.042 sec)
|
|
MariaDB [test]> select
|
-> tbl.table_schema,
|
-> tbl.table_name
|
-> from information_schema.tables tbl
|
-> left join information_schema.key_column_usage as col
|
-> on tbl.table_name = col.table_name
|
-> and col.constraint_schema = tbl.table_schema
|
-> and col.constraint_name = 'PRIMARY'
|
-> where
|
-> tbl.table_schema <> 'information_schema'
|
-> and tbl.table_schema <> 'performance_schema'
|
-> and tbl.table_schema <> 'mysql'
|
-> and col.constraint_name is NULL;
|
+--------------+------------+
|
| table_schema | table_name |
|
+--------------+------------+
|
| test | B2C_S_USER |
|
+--------------+------------+
|
1 row in set (0.052 sec)
|
|
MariaDB [test]> desc B2C_S_USER;
|
+-----------------+-------------+------+-----+---------------------+-------------------------------+
|
| Field | Type | Null | Key | Default | Extra |
|
+-----------------+-------------+------+-----+---------------------+-------------------------------+
|
| ROW_ID | varchar(15) | NO | PRI | NULL | |
|
| LOGIN | varchar(50) | NO | MUL | NULL | |
|
| CDC_INSERT_TIME | datetime | YES | | sysdate() | |
|
| CDC_UPDATE_TIME | timestamp | NO | | current_timestamp() | on update current_timestamp() |
|
| op_ts | datetime | YES | | NULL | |
|
+-----------------+-------------+------+-----+---------------------+-------------------------------+
|
5 rows in set (0.001 sec)
|