MYSQL Tutorial



BASIC MySQL COMMANDS


πŸ“ Basic MySQL Commands β€” Overview

Here’s a quick overview of common MySQL commands you will use to manage databases, tables, and data:

1. Creating and Managing Databases

  • CREATE DATABASE db_name; β€” Create a new database.
  • USE db_name; β€” Select a database to work on.
  • SHOW DATABASES; β€” List all databases.
  • DROP DATABASE db_name; β€” Delete a database.

2. Creating and Managing Tables

  • CREATE TABLE table_name (column1 datatype, column2 datatype, ...); β€” Create a new table.
  • SHOW TABLES; β€” List all tables in the current database.
  • DESCRIBE table_name; β€” Show the structure of a table.
  • DROP TABLE table_name; β€” Delete a table.

3. Inserting, Updating, and Deleting Data

  • INSERT INTO table_name (col1, col2) VALUES (val1, val2); β€” Add new data.
  • SELECT * FROM table_name; β€” Retrieve all data.
  • UPDATE table_name SET col1 = val1 WHERE condition; β€” Modify existing data.
  • DELETE FROM table_name WHERE condition; β€” Remove data.

4. Querying Data

  • SELECT col1, col2 FROM table_name WHERE condition; β€” Select specific columns with filters.
  • ORDER BY col1 ASC|DESC; β€” Sort results ascending or descending.
  • LIMIT n; β€” Limit the number of rows returned.
Note: All MySQL commands end with a semicolon ;. Always remember to use it!

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review