Difference between revisions of "Create database schema document"

From LemonWiki共筆
Jump to navigation Jump to search
m
 
Line 13: Line 13:
  
 
Steps of create database schema document for MySQL
 
Steps of create database schema document for MySQL
# Using [https://www.phpmyadmin.net/ phpMyAdmin]
+
# Using web-based database management software such as: [https://www.phpmyadmin.net/ phpMyAdmin] or [https://www.adminer.org/ Adminer]
 
# 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>}}  
# Click "Print view (with full texts)"
+
# (for phpMyAdmin) Click "Print view (with full texts)"
 
# Copy the table to other word processors
 
# Copy the table to other word processors
  

Latest revision as of 17:12, 1 June 2020

Create database schema document from existing MySQL database.

Table document[edit]

Sample result of mysql query using EXPLAIN syntax[1]: EXPLAIN <table>

Field | Type | Null | Key | Default | Extra

Sample result of mysql query using SHOW syntax[2]: SHOW FULL COLUMNS FROM <table>

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

Steps of create database schema document for MySQL

  1. Using web-based database management software such as: phpMyAdmin or Adminer
  2. SQL query: EXPLAIN <table> or SHOW FULL COLUMNS FROM <table>
  3. (for phpMyAdmin) Click "Print view (with full texts)"
  4. Copy the table to other word processors

DDL document[edit]

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


References[edit]


Related pages: