MySQL Programming Question:
Download Job Interview Questions and Answers PDF
How To Enter Binary Numbers in SQL Statements?
Answer:
If you want to enter character strings or numeric values as binary numbers, you can quote binary numbers with single quotes and a prefix of (B), or just prefix binary numbers with (0b). Binary numbers will be automatically converted into character strings or numeric values based on the expression contexts. Here are some good examples:
SELECT B'010000010100001001000011' FROM DUAL;
ABC
SELECT 0b1000 + 0 FROM DUAL;
8
SELECT B'010000010100001001000011' FROM DUAL;
ABC
SELECT 0b1000 + 0 FROM DUAL;
8
Download MySQL Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Enter Numeric Values as HEX Numbers? | How To Enter Boolean Values in SQL Statements? |