2.3f

SQL Database Commands

Creating and Dropping Databases

  • CREATE DATABASE Database_Name: This command creates a new database in the database management system.

  • DROP DATABASE Database_Name: This command deletes an existing database, including all of its tables and data.

Selecting a Database

  • USE Database_Name: This command sets the selected database as the default for subsequent SQL statements.

Displaying Information about Databases

  • SHOW DATABASES: Lists all databases present in the database system instance.

  • SHOW TABLES: Displays all tables within the currently selected default database. To list tables from a specific database, use the optional clause FROM Database_Name.

Displaying Information about Tables

  • SHOW COLUMNS FROM Table_Name: Lists all columns that exist in the specified Table_Name table of the currently selected default database.

Creating and Displaying Table Structure

Displaying Table Creation Statement

  • SHOW CREATE TABLE Table_Name: This command outputs the CREATE TABLE statement that was used to create the specified Table_Name table in the default database.

robot