CDW MySQL Interview Questions Answers

CDW Most Frequently Asked Latest MySQL Interview Questions Answers

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.
CDW Most Frequently Asked Latest MySQL Interview Questions Answers
CDW Most Frequently Asked Latest MySQL Interview Questions Answers

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 Would You Change A Column From Varchar(10) To Varchar(50)?

ALTER TABLE techpreparation_Questions CHANGE techpreparation_content techpreparation_CONTENT VARCHAR(50).

How Would You Delete A Column?

ALTER TABLE techpreparation_s DROP _user_id.

How Would You Change A Table To Innodb?

ALTER TABLE techpreparation_Questions ENGINE innodb;

When You Create A Table, And Then Run Show Create Table On It, You Occasionally Get Different Results Than What You Typed In. What Does Mysql Modify In Your Newly Created Tables?

1. VARCHARs with length less than 4 become CHARs
2. CHARs with length more than 3 become VARCHARs.
3. NOT NULL gets added to the columns declared as PRIMARY KEYs
4. Default values such as NULL are specified for each column

How Do I Find Out All Databases Starting With 'tech' To Which I Have Access To?

SHOW DATABASES LIKE ‘tech%’;

How Do You Concatenate Strings In Mysql?

CONCAT (string1, string2, string3)

How Do You Get A Portion Of A String?
SELECT SUBSTR(title, 1, 10) from techpreparation_Questions;

What's The Difference Between Char_length And Length?

The first is, naturally, the character count. The second is byte count. For the Latin characters the numbers are the same, but they’re not the same for Unicode and other encodings.

How Do You Convert A String To Utf-8?

SELECT (techpreparation_Question USING utf8);

What Do % And _ Mean Inside Like Statement?

% corresponds to 0 or more characters, _ is exactly one character.

What Does + Mean In Regexp?

At least one character. Appendix G. Regular Expressions from MySQL manual is worth perusing before the interview.

How Do You Get The Month From A Timestamp?

SELECT MONTH(techpreparation_timestamp) from techpreparation_Questions;

How Do You Offload The Time/date Handling To Mysql?

SELECT DATE_FORMAT(techpreparation_timestamp, ‘%Y-%m-%d’) from techpreparation_Questions; A similar TIME_FORMAT function deals with time.

Post a Comment

Previous Post Next Post