Xampp Create Mysql Database and Run SQL Query

Published: 02 April 2023
on channel: Tamil Developer Studio
9,680
160

SQL Queries :

//Create Database
CREATE DATABASE databasename;

//Create Table
CREATE TABLE Persons (
Personid int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (Personid)
);

//Row Insert
INSERT INTO `persons` (`LastName`, `FirstName`, `Age`) VALUES ('NS', 'Sharuk', 10);

//Row Update
UPDATE persons SET LastName = 'NS', FirstName = 'Sharuk',Age = 10 where Personid = 1;

//Get All Row
SELECT * FROM persons

//Get One with condion Row
SELECT * FROM persons WHERE Personid = 1;

//Delete Row
DELETE FROM persons WHERE Personid = 1;

XAMPP is a free and open-source software stack that includes Apache, MySQL, PHP, and Perl. It is used for local development and testing of web applications on a personal computer. MySQL is a popular database management system that is included in the XAMPP stack. Here's how you can use MySQL in XAMPP:

Install XAMPP:
To use MySQL in XAMPP, you first need to install XAMPP on your computer. You can download XAMPP from the official Apache Friends website (https://www.apachefriends.org/index.html) and follow the installation instructions.

Start the XAMPP Control Panel:
Once XAMPP is installed, you can start the XAMPP Control Panel to start and stop the Apache and MySQL servers. The XAMPP Control Panel can be found in the XAMPP installation directory.

Start the MySQL server:
To use MySQL in XAMPP, you need to start the MySQL server. In the XAMPP Control Panel, click on the "Start" button next to "MySQL" to start the MySQL server.

Access MySQL through phpMyAdmin:
To manage your MySQL databases in XAMPP, you can use phpMyAdmin, a web-based interface for managing MySQL databases. To access phpMyAdmin, open your web browser and go to http://localhost/phpmyadmin. Log in using your MySQL username and password.

Create a new database:
To create a new database in XAMPP, click on the "Databases" tab in phpMyAdmin and enter a name for your new database. Click on the "Create" button to create the database.

Create tables and manage data:
Once you have created a database, you can create tables and manage data in phpMyAdmin. Click on the name of your database in the left-hand sidebar to access the tables. You can create new tables, edit existing tables, and manage data by running SQL queries or using the phpMyAdmin interface.

Stop the MySQL server:
When you're done using MySQL in XAMPP, you should stop the MySQL server to free up system resources. In the XAMPP Control Panel, click on the "Stop" button next to "MySQL" to stop the MySQL server.

In summary, XAMPP includes MySQL as a database server that can be accessed using the phpMyAdmin interface. To use MySQL in XAMPP, you need to start the MySQL server, create a new database, and create tables and manage data using SQL queries or the phpMyAdmin interface. Once you're done using MySQL in XAMPP, you should stop the MySQL server.

When working with MySQL databases in XAMPP, you can use various SQL queries to manage your data. Here are some examples of how to use MySQL queries in XAMPP:

Creating a new database:
To create a new database in XAMPP, you can use the following SQL query:

CREATE DATABASE dbname;

Replace "dbname" with the name of the database you want to create.

Creating a new table:
To create a new table in XAMPP, you can use the following SQL query:

CREATE TABLE tablename (
column1 datatype,
column2 datatype,
column3 datatype,
...
);

Replace "tablename" with the name of the table you want to create. Define the column names and their corresponding data types in the parenthesis.

Inserting data into a table:
To insert data into a table in XAMPP, you can use the following SQL query:

INSERT INTO tablename (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

Replace "tablename" with the name of the table you want to insert data into. Define the column names in the first set of parenthesis and the values you want to insert in the second set of parenthesis.

Updating data in a table:
To update data in a table in XAMPP, you can use the following SQL query:

UPDATE tablename
SET column1 = value1, column2 = value2, ...
WHERE condition;

Replace "tablename" with the name of the table you want to update data in. Define the column names and their corresponding new values in the SET clause. Use the WHERE clause to specify the condition that must be met for the data to be updated.

Deleting data from a table:
To delete data from a table in XAMPP, you can use the following SQL query:

DELETE FROM tablename
WHERE condition;

Replace "tablename" with the name of the table you want to delete data from. Use the WHERE clause to specify the condition that must be met for the data to be deleted.

In summary, MySQL queries can be used in XAMPP to manage your data. You can create new databases and tables, insert data into tables, update existing data, and delete data from tables using SQL queries in XAMPP.


On this page of the site you can watch the video online Xampp Create Mysql Database and Run SQL Query with a duration of online in good quality, which was uploaded by the user Tamil Developer Studio 02 April 2023, share the link with friends and acquaintances, this video has already been watched 9,680 times on youtube and it was liked by 160 viewers. Enjoy your viewing!