Create database schema document: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
Create database schema document for MySQL
== Table document ==
Sample result of mysql query: {{kbd | key =<nowiki>EXPLAIN <table></nowiki>}}
<pre>
Field | Type | Null | Key | Default | Extra
</pre>
sample result of mysql query: {{kbd | key =<nowiki>SHOW FULL COLUMNS FROM <table></nowiki>}}
<pre>
Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment
</pre>


Steps of create database schema document for MySQL
Steps of create database schema document for MySQL
# Using [https://www.phpmyadmin.net/ phpMyAdmin]
# Using [https://www.phpmyadmin.net/ phpMyAdmin]
# SQL query: {{kbd | key =<nowiki>EXPLAIN <table></nowiki>}} or {{kbd | key =<nowiki>SHOW FULL COLUMNS FROM <table></nowiki>}}  
# SQL query: {{kbd | key =<nowiki>EXPLAIN <table></nowiki>}} or {{kbd | key =<nowiki>SHOW FULL COLUMNS FROM <table></nowiki>}}  
Line 7: Line 18:
# Copy the table to other word processors
# Copy the table to other word processors


sample result of mysql query: {{kbd | key =<nowiki>EXPLAIN <table></nowiki>}}
== DDL document ==
[https://en.wikipedia.org/wiki/Data_definition_language Data definition language] (DDL): Sample result of mysql query: {{kbd | key =<nowiki>SHOW CREATE TABLE <table></nowiki>}}
<pre>
<pre>
Field | Type | Null | Key | Default | Extra
CREATE TABLE `table` (
</pre>
  `id` varchar(30) NOT NULL,
sample result of mysql query: {{kbd | key =<nowiki>SHOW FULL COLUMNS FROM <table></nowiki>}}
  `note` varchar(30) DEFAULT NULL,
<pre>
  `status` int(1) NOT NULL DEFAULT '1',
Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8
</pre>
</pre>


Navigation menu