June 4, 2019

Srikaanth

Birlasoft MySQL Interview Questions Answers

Birlasoft MySQL Most Frequently Asked Latest Interview Questions Answers

What Is Ddl, Dml And Dcl ?

If you look at the large variety of SQL commands, they can be divided into three large subgroups. Data Definition Language deals with database schemas and descriptions of how the data should reside in the database, therefore language statements like CREATE TABLE or ALTER TABLE belong to DDL. DML deals with data manipulation, and therefore includes most common SQL statements such SELECT, INSERT, etc. Data Control Language includes commands such as GRANT, and mostly concerns with rights, permissions and other controls of the database system.

How Do You Get The Number Of Rows Affected By Query?

SELECT COUNT (user_id) FROM users would only return the number of user_id’s.

If The Value In The Column Is Repeatable, How Do You Find Out The Unique Values?

Use DISTINCT in the query, such as SELECT DISTINCT user_firstname FROM users; You can also ask for a number of distinct values by saying SELECT COUNT (DISTINCT user_firstname) FROM users;

How Do You Return The A Hundred Books Starting From 25th?

SELECT book_title FROM books LIMIT 25, 100. The first number in LIMIT is the offset, the second is the number.
Birlasoft MySQL Most Frequently Asked Latest Interview Questions Answers
Birlasoft MySQL Most Frequently Asked Latest Interview Questions Answers

You Wrote A Search Engine That Should Retrieve 10 Results At A Time, But At The Same Time You'd Like To Know How Many Rows There're Total. How Do You Display That To The User?

SELECT SQL_CALC_FOUND_ROWS page_title FROM web_pages LIMIT 1,10; SELECT FOUND_ROWS(); The second query (not that COUNT() is never used) will tell you how many results there’re total, so you can display a phrase "Found 13,450,600 results, displaying 1-10". Note that FOUND_ROWS does not pay attention to the LIMITs you specified and always returns the total number of rows affected by query.

How Would You Write A Query To Select All Teams That Won Either 2, 4, 6 Or 8 Games?

SELECT team_name FROM teams WHERE team_won IN (2, 4, 6, 8)

How Would You Select All The Users, Whose Phone Number Is Null?

SELECT user_name FROM users WHERE ISNULL(user_phonenumber);

What Does This Query Mean: Select User_name, User_isp From Users Left Join Isps Using (user_id) ?

It’s equivalent to saying SELECT user_name, user_isp FROM users LEFT JOIN isps WHERE users.user_id=isps.user_id

How Do You Find Out Which Auto Increment Was Assigned On The Last Insert?

SELECT LAST_INSERT_ID() will return the last value assigned by the auto_increment function. Note that you don’t have to specify the table name.

What Does -i-am-a-dummy Flag To Do When Starting Mysql?

Makes the MySQL engine refuse UPDATE and DELETE commands where the WHERE clause is not present.

On Executing The Delete Statement I Keep Getting The Error About Foreign Key Constraint Failing. What Do I Do?

What it means is that so of the data that you’re trying to delete is still alive in another table. Like if you have a table for universities and a table for students, which contains the ID of the university they go to, running a delete on a university table will fail if the students table still contains people enrolled at that university. Proper way to do it would be to delete the offending data first, and then delete the university in Question. Quick way would involve running SET foreign_key_checks=0 before the DELETE command, and setting the parameter back to 1 after the DELETE is done. If your foreign key was formulated with ON DELETE CASCADE, the data in dependent tables will be removed automatically.

When Would You Use Order By In Delete Statement?

When you’re not deleting by row ID. Such as in DELETE FROM techpreparation_com_Questions ORDER BY timestamp LIMIT 1.

How Can You See All Indexes Defined For A Table?

SHOW INDEX FROM techpreparation_Questions;

How Is Myisam Table Stored?

MyISAM table is stored on disk in three formats.

'.frm' file : storing the table definition
'.MYD' (MYData): data file
'.MYI' (MYIndex): index file

What Is The Usage Of Enums In Mysql?


ENUMs are used to limit the possible values that go in the table:

For example: CREATE TABLE months (month ENUM 'January', 'February', 'March'); INSERT months VALUES ('April').

What Are The Advantages Of Myisam Over Innodb?

MyISAM follows a conservative approach to disk space management and stores each MyISAM table in a separate file, which can be further compresses, if required. On the other hand, InnoDB stores the tables in tablespace. Its further optimization is difficult.


Subscribe to get more Posts :