Database Statements

  • SHOW [DATABASES / SCHEMAS / CHARACTER SET / CHARSET / COLLATION]

  • CREATE [DATABASE / SCHEMA] {IF NOT EXISTS} {database_name}

  • USE {database_name}

  • DROP [DATABASE / SCHEMA] {IF EXISTS} {database_name}

  • ALTER [DATABASE / SCHEMA] {database_name} [CHARACTER SET / CHARSET [=] utf8 COLLATE [=] utf8_unicode_ci]

  • SELECT [version() / database()]

  • BACKUP DATABASE database_name TO DISK = "filepath" [WITH DIFFERENTIAL];

Comment

# This comment continues to the end of the line
-- This comment continues to the end of the line
/* This is an in-line or multiple-line comment */

Get the Version of Database

SELECT version();

Create a New Database

CREATE DATABASE `database_name`;

List all Database Name

Get the Character Set and Collection

Create a New Database including Character Set and Collection

Use a Database

Get the currently selected Database

Drop a Database

Alter Database

Backup Database

Notes:

  • SCHEMA is a synonym for DATABASE

  • CHARSET is a synonym for CHARACTER SET

  • Character Set: A character set is a set of symbols and encodings.

  • Collation: A collation is a set of rules for comparing characters in a character set.

  • Differential backup only the changes after the last backup.

Last updated

Was this helpful?