Basic Mysql Commands

Basic Mysql Commands

There are many commands used in mysql and some of the basic commands are given below:

  1. Create
  2. Insert
  3. Update
  4. Delete
  5. Select
  6. Use

Now it’s time to describe these basic commands, if you are a beginner then you have to focus on these commands.

To start in mysql first we have to create the database which we can create with the help of create  command

command for creating database

create database myfirstdb ; 

in above command myfirstdb is the name of database you can give any name that you want, now you have successfully created the database now it’s time to use this database for creating tables .

command for use the database

use myfirstdb ;

Now you have selected the database with name myfirstdb ,now every table that you create ‘ll come inside the myfirstdb database, now create some table

command for creating table

  create table myFirstTable(id int , name varchar(20), primary key(id));

Using the above command you have successfully created the table with name myFirstTable, now it’s time to insert the data into the table

command for insert data into table

insert into myFirstTable(id, name) values(1,”javadream”);

Now you have successfully inserted  one row into table to show this row you have to use the command select

command for display table data

                  select * from myFirstTable;

We have use all the command for creating ,inserting and displaying the tables data, now if you want to update any data in table then you have to use the update command

command for update table data

update myFirstTable set name = “i love javadream” where id = 1;

Now if you want to delete any row from the table then you have to use the delete command

command for delete data

delete from myFirstTable where id = 1;


some related topics for mysql

How to take database backup in mysql

How to create user in Mysql

Help Others, Please Share

Leave a Reply

Your email address will not be published. Required fields are marked *