Query database field problem

  • for example, I want to query a table in the backend. In the test, table, there is an id increment, a unique field A, and one is the insertion time insert_time, and one is the type. If I want to query, it is based on which unique field (SELECT FROM test WHERE A = "xx"). It is not necessary to use (SELECT FROM test WHERE id= "xx" AND A = "xx" AND insert_time= "xx"). Thank you
Apr.09,2021

usually yes. You can determine the only piece of data through A, and other conditions are useless.

but you can prevent counterfeiting if you add all the conditions. if someone knows that A has forged id and insert_time, then there must be no data that satisfies the three conditions of id, An and insert_time at the same time. At this time, checking An alone will return the result, but there is no data at the same time.

take a scenario example:
ID number is unique. Although you can query personal information only by ID number, when your real name is serious, you will be required to provide both ID number and name information to ensure that the information matches. At this point, you need to explicitly use two conditions to determine the data.

  

ensure that the field is unique without adding additional conditions, of course. The purpose of adding AND condition is to get the final result accurately

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35d69-2b512.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35d69-2b512.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?