MyISAM to InnoDB: Conversion (SQL Interview Q&A)

preview_player
Показать описание
In this sql interview questions and answers video we'll answer one of the most prominent questions pertaining to mysql storage engines innodb and myisam and tell you how you should go about converting your tables running the mysql myisam storage engine to the innodb storage engine instead.

We will answer the following sql interview questions (for answers to these sql interview questions, see sql queries that you need to run on your mysql server, mariadb, or percona instance below):

Q: How to quickly switch all of the tables in your sql database instance from MyISAM to InnoDB?

Q: What is the single SQL query that will let me figure out which tables in my sql database instance are running MyISAM?

Some more of sql interview questions and answers can be found below:
Q: MyISAM performs row level locking?
A: No, that's a common misconception.

Q: MyISAM vs InnoDB performance - which one is better and why?
A: InnoDB - all of the features that were available in MyISAM are now available in InnoDB.

Q: I want to switch MyISAM to InnoDB - what sql query should I use? Is there a sql tutorial that would help me with this?
A: Use the SQL queries provided in this tutorial. These are as follows:

1) We figure out what tables are using the MyISAM storage engine to begin with (replace "dbname" with the name of your sql database):
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbname' AND ENGINE = 'MyISAM';

2) Now we need to convert our MyISAM storage engine tables in our MySQL server to InnoDB instead (consider putting this sql query inside of a loop so that you don't have to run it over an over when the situation requires you to do so):
ALTER TABLE `table_name` ENGINE = InnoDB;

Music:
Creative Commons — Attribution 3.0 Unported — CC BY 3.0

#shorts #reels #database #sql #mysql #webdevelopment #developer #webdeveloper
Рекомендации по теме