What is MySQL?

MySql is a Relational Database Management Systems(RDBMS). It is open-source database software. It is commonly used in PHP, Python and Node etc. MySql is cross-platform it runs on Mac, Windows and Linux operating systems. It is very fast and easy to use. MySQL uses SQL (Structured Query Language) to manipulate database.

What is a Database?

A Database is a collection of data that is organized in a table format. The main purpose of the database is to store, retrieve, update and manage the data easily.

  • Database : db_sample
  • Tables in db_sample : categories,customers,orders,order_details,products
mysql database

Table :

A database table is a collection of data elements organized in the form of rows, columns and indexes (Primary Key).

mysql table

Column or Field :

Each column in a table stores a certain kind of data. For example, the customer_name column contains both text and number values and the customer_id(Primary Key) column contains only integer values.

mysql table column

Row or Record:

Each row in a table represents a group of related information that contains different data types. For example, a single row contains the customer's related information like name, contact and email id.

mysql table row


A query is a commands which is used to retrieve data from a table. Some of commonly used MySQL queries as follows,

1.Create Database

create database query is used to create new database.

create database db_sample
2.Use Database

use query is used to set database as current database in MySQL.

use db_sample
3.Create Table

CREATE TABLE query is used to create table in database.

CREATE TABLE  categories (
  category_id int(10) unsigned NOT NULL AUTO_INCREMENT,
  category_name varchar(45) NOT NULL DEFAULT '',
  PRIMARY KEY (category_id)
4.Insert Query

INSERT query is used to insert record into table.

insert into categories (category_name) values ('Toys');
5.Select Query

SELECT query is used to fetch records from the table.

SELECT * FROM categories
6.Update Query

UPDATE query is used to update the records in the table.

update categories set category_name='Mobiles' where category_id=10
7.Delete Query

DELETE query is used to delete the records from the table.

delete from categories where category_id=10
8.Truncate Query

TRUNCATE query is used to remove all the records from the table.

TRUNCATE categories

Run your MySQL code in online with sample database. Online MySql Query Editor