What is MySQL?
MySQL is a fast, easy-to-use RDBMS being used for
many small and big businesses. MySQL is developed, marketed and supported by
MySQL AB, which is a Swedish company. Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter,8 and “SQL”, the abbreviation for Structured Query Language.
MySQL Workbench
provides data modeling, SQL development, and comprehensive administration tools
for server configuration, user administration, backup, and much more. MySQL
Workbench is available on Windows, Linux and Mac OS X. The
data in a MySQL database are stored in tables. A table is a collection of
related data, and it consists of columns and rows.
Why MYSQL?
·
MySQL is released under an open-source
license. So you have nothing to pay to use it.
·
MySQL is a very powerful program in its
own right. It handles a large subset of the functionality of the most expensive
and powerful database packages.
·
MySQL supports large databases, up to 50
million rows or more in a table. The default file size limit for a table is
4GB, but you can increase this (if your operating system can handle it) to a
theoretical limit of 8 million terabytes (TB).
·
MySQL works on many operating systems
and with many languages including PHP, PERL, C, C++, JAVA, etc.
·
MySQL is customizable. The open-source
GPL license allows programmers to modify the MySQL software to fit their own
specific environments.
·
Many
of the world’s largest and fastest-growing organizations including Facebook,
Google, Adobe, Alcatel Lucent and Zappos rely on MySQL to save time and money
powering their high-volume Web sites, business-critical systems and packaged
software.
Offshoots of MySQL
Offshoots of
MySQL are called forks. They include:
1. Drizzle – a
lightweight open source database management system in development based on
MySQL 6.0.
2. MariaDB
– a popular community-developed “drop-in” replacement for MySQL that
uses MySQL APIs and commands.
3. Percona
Server with XtraDB– an enhanced version of MySQL known for horizontal scalability.
MySQL
Queries
1)
MySQL Create Database
MySQL create
database is used to create database.
For example
create database db1;
2) MySQL
Select/Use Database
MySQL use
database is used to select database.
For example
use db1;
3) MySQL
Create Query
MySQL
create query is used to create a table, view, procedure and function.
For example:
CREATE TABLE customers
(id int(10),
name varchar(50),
city varchar(50),
PRIMARY KEY (id )
);
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:
ALTER TABLE customers
ADD age varchar(50);
5) MySQL
Insert Query
MySQL
insert query is used to insert records into table.
For example:
insert into customers values(101,’rahul’,’delhi’);
6) MySQL Update Query
MySQL
update query is used to update records of a table.
For example:
update customers set name=’bob’, city=’london’ where id=101;
7) MySQL Delete Query
MySQL
update query is used to delete records of a table from database.
For example:
delete from customers where id=101;
8) MySQL Select Query
Oracle
select query is used to fetch records from database.
For example:
SELECT * from customers;
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:
truncate table customers;