Basic concept of MySql Database (Part 1)

Basic concept of MySql Database (Part 1)

Hey guys, what’s up? Today I am here to provide you some basic idea about MySQL database.

So, what is MySQL?

MySQL is a database system runs on web server. It is very fast, reliable, and easy to use.  It is open-source database and free to download. It uses standard SQL. It is commonly used with PHP scripts to create powerful and dynamic website. MySQL supports many languages like Python, PERL, PHP, JAVA, C, C#, C++, Ruby & so on.

Note:  MySQL version less than 5.0 doesn’t support COMMIT, stored and ROLE procedure.

MySQL Data Types

Following are most commonly used data type in mySql database system.

ü  Numeric Data Type: INT, FLOAT(m,d), DOUBLE(m,d), DECIMAL(m,d)

[total  digit length (m) & number after  decimals point is (d)]

ü  String Data Types:  CHAR(size), VARCHAR(size)

Difference between VARCHAR & CHAR:

ü  VARCHAR uses dynamic memory allocation where CHAR uses static memory allocation.

ü  CHAR is 50% faster than VARCHAR.

ü  VARCHAR is of fixed length where CHAR is variable-length

Difference between DOUBLE & FLOAT:

DOUBLE stores floating point numbers up to 18 places & allocate 8 bytes where FLOAT stores floating point numbers up to 8 places & allocate 4 bytes.

We can establish MySQL database connection in two ways-

1)      Using MySQL Binary

2)      Using PHP Script

PHP 5+ can work with a MySQL database using PDO (PHP Data Objects) & MySQLi extension (the “i” stands for improved). MySQLi will only work with MySQL databases, on the other hand PDO will work on 12 different database systems. Prepared Statements protect from SQL injection, and are very important for web application security. Both PDO & MySQLi are object-oriented & support Prepared Statements, but MySQLi also offers a procedural API.

That’s all for today. In second part we will discuss about MySQL, MySQLi, PDO Connection using PHP Script. Thanks for being with us. Bye

Post a Comment