Breaking News
Loading...
Saturday 6 August 2011

Mysql Interview Question and Answers 3

00:22
21. Differentiate the LIKE and REGEXP operators?
SELECT * FROM pet WHERE name REGEXP "^b";
SELECT * FROM pet WHERE name LIKE "%b";

22. What are the String types are available for a column?
The string types are CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET.

23. What is the REGEXP?
A REGEXP pattern match succeed if the pattern matches anywhere in the value being tested.

24. What is the difference between CHAR AND VARCHAR?
The CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved.
The length of a CHAR column is fixed to the length that you declare when you create the table.
The length can be any value between 1 and 255. When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed.

25. How quoting and escaping work in SELECT QUERY?
SELECT ‘hello’, ‘“hello”’,‘““hello””’, ‘hel‘‘lo’, ‘\‘hello’.

26. What is the difference between BLOB AND TEXT?
A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types TINYBLOB,BLOB, MEDIUMBLOB, and LONGBLOB differ only in the maximum length of the values they can hold.
The four TEXT types TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT correspond to the four BLOB types and have the same maximum lengths and storage requirements. The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive fashion for BLOB values and case-insensitive fashion for TEXT values. In other words, a TEXT is a case-insensitive BLOB.

27. How we get Sum of column?
mysql> SELECT * FROM tablename;

28. How do you get current user in mysql?
SELECT USER();

29. How would you change a table to InnoDB?
ALTER TABLE name_file ENGINE innodb;

30. How do you concatenate strings in MySQL?
CONCAT (string1, string2, string3)


Share This :
Tags:

0 comments:

Post a Comment

 
Toggle Footer