Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

MySQL Queries

A list of commonly used MySQL queries to create database, use database, create table, insert record, update record, delete record, select record, truncate table and drop table are given below.

1) MySQL Create Database

MySQL create database is used to create database. For example

  1. create database db1;

More Details…

2) MySQL Select/Use Database

MySQL use database is used to select database. For example

  1. use db1;

More Details…

3) MySQL Create Query

MySQL create query is used to create a table, view, procedure and function. For example:

  1. CREATE TABLE customers
  2. (id int(10),
  3.  name varchar(50),
  4.  city varchar(50),
  5.  PRIMARY KEY (id )
  6. );

More Details…

4) MySQL Alter Query

MySQL alter query is used to add, modify, delete or drop colums of a table. Let’s see a query to add column in customers table:

  1. ALTER TABLE customers
  2. ADD age varchar(50);

More Details…

5) MySQL Insert Query

MySQL insert query is used to insert records into table. For example:

  1. insert into customers values(101,‘rahul’,‘delhi’);

More Details…

6) MySQL Update Query

MySQL update query is used to update records of a table. For example:

  1. update customers set name=‘bob’, city=‘london’ where id=101;

More Details…

7) MySQL Delete Query

MySQL update query is used to delete records of a table from database. For example:

  1. delete from customers where id=101;

More Details…

8) MySQL Select Query

Oracle select query is used to fetch records from database. For example:

  1. SELECT * from customers;

More Details…

9) MySQL Truncate Table Query

MySQL update query is used to truncate or remove records of a table. It doesn’t remove structure. For example:

  1. truncate table customers;

More Details…

10) MySQL Drop Query

MySQL drop query is used to drop a table, view or database. It removes structure and data of a table if you drop table. For example:

  1. drop table customers;

More Details…