2-SQL_BASIC-GUIDE-BEGINNER-1
2-SQL_BASIC-GUIDE-BEGINNER-1
This guide is designed to help you navigate MySQL in XAMPP using shell
commands. Whether you're a beginner or have some experience with
databases, this step-by-step guide will walk you through the essentials.
Table of Contents
1. Download XAMPP
2. Install XAMPP
4. Verify Installation
o mysql -u root -p
3. Confirm Access
o EXIT;
Tip: If you encounter issues, ensure MySQL is running in the XAMPP Control
Panel.
Learning a few basic commands will help you navigate and manage your
databases effectively. Below is a list of commonly used MySQL commands
with explanations:
Command Description
Detailed Examples
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
3. Use a Database
USE test_db;
Output:
Database changed
EXIT;
o SHOW DATABASES;
Selecting a Database
o USE my_database;
o Output:
o Database changed
Deleting a Database
This section covers commonly used MySQL queries, their purposes, and
detailed examples to help you master their usage.
Query: SELECT
Example:
Output:
+--------+-----+
| name | age |
+--------+-----+
| John | 20 |
| Alice | 22 |
+--------+-----+
Query: INSERT
Example:
Output:
Query: UPDATE
Purpose: Update existing data in a table.
Example:
Output:
Query: DELETE
Example:
Output:
column1 datatype,
column2 datatype
);
Example:
name VARCHAR(100),
age INT
);
Output:
Example:
Output:
1. Create a Database
o Command:
2. Create a Table
o Command:
o name VARCHAR(50),
o age INT
o );
3. Insert Data
o Command:
o INSERT INTO students (name, age) VALUES ('John', 20), ('Alice',
22), ('Bob', 25);
4. Retrieve Data
o Command:
5. Filter Data
o Command:
6. Update Data
o Command:
7. Delete Data
o Command: