Mysql/CheatSheet: Difference between revisions

From Wiki
Line 49: Line 49:
<pre>
<pre>
CREATE TABLE [IF NOT EXISTS] table_name(
CREATE TABLE [IF NOT EXISTS] table_name(
   column_list
   column1,
  column2
);
);
</pre>
</pre>
Line 60: Line 61:
</pre>
</pre>
</blockquote>
</blockquote>


== other ==  
== other ==  

Revision as of 14:51, 15 June 2020

Databases

  • Create
CREATE DATABASE [IF NOT EXISTS] database_name;
  • Use
USE database_name;
  • Delete
DROP DATABASE [IF EXISTS] database_name;
  • List all
SHOW DATABASE;
  • Storage Engines
    • MyISAM (optimized for compression and speed. portable. not transaction safe. used to be default)
    • InnoDB (optimized for speed. portable. portable. default)
    • MERGE
    • MEMORY (HEAP)
    • ARCHIVE
    • CSV
    • FEDERATED

Tables

  • list
SHOW TABLES;
  • create
CREATE TABLE [IF NOT EXISTS] table_name(
  column1,
  column2
);

other