MySQL Interview Questions – Set 04

How to search second maximum(second highest) salary value(integer)from table employee (field salary)in the manner so that mysql gets less load? By below query we will get second maximum(second highest) salary value(integer)from table employee (field salary)in the manner so that mysql gets less load? SELECT DISTINCT(salary) FROM employee order by salary desc limit 1 , 1 … Read more

MySQL Interview Questions – Set 03

How to give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs # mysql -u root -p # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,’databasename’,’username’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’); mysql> flush privileges; or mysql> grant all privileges on databasename.* to username@localhost; mysql> flush privileges … Read more

MySQL Interview Questions – Set 02

How to dump a table from a database. # [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql How we get Sum of column mysql> SELECT SUM(*) FROM [table name]; How to allow the user “sonia” to connect to the server from localhost using the password “passwd”. Login as root. Switch to the MySQL … Read more

MySQL Interview Questions – Set 01

Syntax and Queries MySQL Commands: Show databases; Create database db_name; Use dbname; Show tables; Create table tb_name(id int, name varchar(20)); Desc tb_name; Insert into tb_name values(101 , ‘name of person’); Insert into tb_name (id) values(102); Update tb_name set name=’person name’ where id=102; Select * from tb_name; Delete from tb_name where id=102; Drop table tb_name; Drop … Read more

MySQL Interview Questions

MySQL Interview Questions – Set 14 MySQL Interview Questions – Set 13 MySQL Interview Questions – Set 12 MySQL Interview Questions – Set 11 MySQL Interview Questions – Set 10 MySQL Interview Questions – Set 09 MySQL Interview Questions – Set 08 MySQL Interview Questions – Set 07 MySQL Interview Questions – Set 06 MySQL … Read more