How to use case expression?



How to use case expression?..

Answer / Km.priti

To use CASE expressions in MySQL, you can write a conditional statement that evaluates multiple conditions and returns different results for each condition. Here's an example:n`nSELECT COLUMN_NAME,ntCASEntWHEN data_type = 'int' THEN 'integer'ntWHEN data_type = 'varchar' THEN 'string'ntELSE 'other type'ntEND AS DataType FROM information_schema.columns WHERE table_name='YourTable';n`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MySQL Interview Questions

Explain MySQL optimization?

1 Answers  


What is the difference between char and varchar in mysql?

1 Answers  


How many ways we can we find the current date using MySQL?

3 Answers  


Difference between CHAR and VARCHAR?

1 Answers  


Can we store files in mysql?

1 Answers  


What is default password for mysql?

1 Answers  


How do I create a stored procedure in mysql?

1 Answers  


Write command to import an mysql file?

1 Answers  


How to use in conditions?

1 Answers  


How you will Show unique records.

1 Answers  


What are the 3 main types of search queries?

1 Answers  


Is microsoft sql same as mysql?

1 Answers  


Categories