Follow Me:
Showing posts with label Mysql and SQL. Show all posts
Showing posts with label Mysql and SQL. Show all posts

Friday 7 August 2015

Differences between InnoDB and MyISAM 

   In MySQL, major difference of InnoDB and  MyISAM are given below. MyIsam is supporting the table level locking in database. But InnoDB is supporting the row level locking in the database. MyIsam is supporting the FULL TEXT SEARCH functionality and InnoDB also supporting the FULL TEXT SEARCH after MySQL Version of 5.6.4.

 

 MyISAM Engine : 

1. It supporting Table-level Locking
2. It supports FULLTEXT SEARCH functionality
3. It is designed for need of speed
4. It is not supporting foreign key constraints
5. It is storing the data as its tables, data and indexes in diskspace using separate three different files formats. (table.FRM, table.MYD, table.MYI)
6. It is not supporting transactions [ We can't COMMIT and ROLLBACK the comments ]
7. It recovering data by using Requires full repair/rebuild of indexes/tables
8. It is storing the data as no ordering format

INNODB Engine : 

1. It is supporting Row-level Locking
2. After MySQL Version 5.6.4 ,Supporting FULL TEXT SEARCH functionality
3. It is designed for maximum performance when processing high volume of data
4. It is supporting foreign key constraints
5. It is supporting transactions [ We can COMMIT and ROLLBACK the comments ]
6. It stores data as tables and indexes in a tablespace
7. It is Auto recovery from crash via replay of logs
8. It is stored the data row as primary key order


Saturday 10 January 2015

mysql> desc codingslover;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| ProjId   | varchar(20) | NO   | PRI | NULL    |       |
| BranchId | int(11)     | YES  |     | NULL    |       |
| AddedOn  | datetime    | YES  |     | NULL    |       |
| Status   | int(11)     | YES  |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> desc codingslover ProjId;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| ProjId  | varchar(20) | NO   | PRI | NULL    |       |
+---------+-------------+------+-----+---------+-------+
1 row in set (0.00 sec)


Friday 28 February 2014

What is .frm, .myi, .myd. txt file in PhpMyadmin and MySQl?

When creating the table in database,that time 3 text file is generated in local.That files are 
 .FRM  =>  It has the table structure of your table or table definition

 .MYI  =>   It has the indexes of your table

 .MYD =>   It contains your data

Generally you can find the data directory of your file with your .my.cnf file. The physical structure of db is some thing like a directory structure, where each database is a subdirectory under the main directory and has some files in it. Each table has its own file. Bascially one can see three types of files .frm, .myi, .myd.. But they are not same for all tables and db. They differ based on the engines you use and sometimes even differ with the os. There are lots of other factors that is in the backend behind the type of files you see. We will  see some basic differences.

For ex: if your db name is school and tables called class and student. The Physical structure will have a directory called school and files class.frm, class.myi, class.myd, student.frm, student.myi, student.myd.

Thursday 13 February 2014

  To import csv files into the mysql table,for this removing the header of the csv files and then run the below script.It will be insert into our mysql table.

//Import csv files into mysql table

LOAD DATA LOCAL INFILE 'd:\\Site.csv' INTO TABLE `siteurl` 
FIELDS TERMINATED BY ',' ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n';

//ends


Character Escape Sequence

\0 An ASCII NUL (0x00) character
\b A backspace character
\n A newline (linefeed) character
\r A carriage return character
\t A tab character
\Z ASCII 26 (Control+Z)
\N NULL

Note : Your File must be a Csv file.Then only it will be working.
  Csv File Name as Site.csv
  Table Name as siteurl

Csv Files import in MySql, Csv Files import in php, Import CSV Files into MySQL table