Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where binary in SQL

Tags:

mysql

I have an SQL statement:

SELECT * FROM customers WHERE BINARY login='xxx' AND password='yyyy'

There are no blob/binary fields in the table, do I need the BINARY after the WHERE what else does it do?

like image 461
fire Avatar asked Mar 17 '10 14:03

fire


People also ask

What is binary query SQL?

The MySQL BINARY function is used for converting a value to a binary string. The BINARY function can also be implemented using CAST function as CAST(value AS BINARY). The BINARY function accepts one parameter which is the value to be converted and returns a binary string.

Can SQL store binary data?

Binary, Varbinary & Varbinary(max) are the binary string data types in SQL Server. These data types are used to store raw binary data up to a length of (32K – 1) bytes. The contents of image files (BMP, TIFF, GIF, or JPEG format files), word files, text files, etc. are examples of binary data.

What is binary data in database?

Binary data is a type of data that is represented or displayed in the binary numeral system. Binary data is the only category of data that can be directly understood and executed by a computer. It is numerically represented by a combination of zeros and ones.

How do I get the size of a Varbinary in SQL?

The VARBINARY(MAX) field allocates variable length data up to just under 2GB in size. You can use DATALENGTH() function to determine the length of the column content.


1 Answers

BINARY is a built-in keyword that after your WHERE clause that forces a comparison for an exact case-sensitive match.

As a side note, you can also make columns case-sensitive by adding the BINARY keyword when you create your table.

like image 94
Anthony Forloney Avatar answered Jan 04 '23 02:01

Anthony Forloney