Create database schema document: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:


Create database schema document for MySQL
Create database schema document from existing MySQL database.


== Table document ==
== Table document ==
Line 29: Line 29:
</pre>
</pre>


tools: SQL syntax beautifier
Tools: SQL syntax beautifier
* [http://www.dpriver.com/pp/sqlformat.htm Instant SQL Formatter]
* [http://www.dpriver.com/pp/sqlformat.htm Instant SQL Formatter]


related pages:
Related pages:
* [[Data type]]
* [[Data type]]


[[Category:MySQL]]
[[Category:MySQL]]
[[Category:Data Science]]
[[Category:Data Science]]

Revision as of 11:53, 6 February 2017

Create database schema document from existing MySQL database.

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

Tools: SQL syntax beautifier

Related pages: