MySQL table management commands

Source: Internet
Author: User

There are many MySQL table management commands. The following describes some of the most common MySQL table management commands. If you are interested in MySQL table management, take a look.

# Creating a database

 
 
  1. CREATE DATABASE GXDATA DEFAULT CHARACTER SET gb2312;  

# Create a department information table

 
 
  1. CREATE TABLE depinfo (  
  2. Dep_no CHAR(2) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,  
  3. Dep_name VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,  
  4. Dep_Address VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,  
  5. Dep_Tel VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL  
  6. )ENGINE=MyISAM DEFAULT CHARSET=gb2312;  

When the temporary table database is closed, the temporary table is automatically deleted)

 
 
  1. Create temporary table table_name (... defines the column ......)
  2.  

Clone table

 
 
  1. CREATE TEMPORARY TABLE new_table LIKE original_table  
  2.  

Create a table based on the query results

 
 
  1. CREATE TEMPORARY TABLE table_name SELECT ... ...  
  2.  

Query and change the table Storage Engine

 
 
  1. SELECT ENGIN FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='database_name' AND TABLE_NAME ='tabne_name' 
  2.  
  3. SHOW TABLE STATUS LIKE 'table_name' \G  
  4.  
  5. SHOW CREATE TABLE table_name \G  
  6.  

Change storage engine

 
 
  1. ALTER TABLE table_name ENGINE=InnoDB 
  2.  

Quick table creation in mysql

In-depth study on MySQL's data deletion from multiple tables

Simple MySQL large table backup method

Combination of multiple MySQL table result sets

Analysis of MySQL Chinese Table creation Problems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.