Create database schema document: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
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>



Revision as of 09:14, 26 August 2016

Create database schema document for MySQL

Table document

Sample result of mysql query: EXPLAIN <table>

Field | Type | Null | Key | Default | Extra

sample result of mysql query: SHOW FULL COLUMNS FROM <table>

Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment

Steps of create database schema document for MySQL

  1. Using phpMyAdmin
  2. SQL query: EXPLAIN <table> or SHOW FULL COLUMNS FROM <table>
  3. Click "Print view (with full texts)"
  4. Copy the table to other word processors

DDL document

Data definition language (DDL): Sample result of mysql query: SHOW CREATE TABLE <table>

CREATE TABLE `table` (
  `id` varchar(30) NOT NULL,
  `note` varchar(30) DEFAULT NULL,
  `status` int(1) NOT NULL DEFAULT '1',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8


related pages: