This loss has been eaten many times, in the development of the previous SQL code, many with or as a where condition of the query, or even update. Here are examples of the drawbacks of using or, and the ways to improve them. Select f_crm_id from d_dbname1.t_tbname1 where f_xxx_id = 926067 and (f_mobile = ' 1234567891 ' or f_phone = ' 1234567891 ') Li MIT 1 from the query statement it is easy to see, F_mobile and F_phone two fields are likely to save the phone number, the general idea is to use or to a SQL solution, but the table data volume is a disaster: T_tbanme1 has an index idx_id_mobile (
1. How are the or conditions used? Summarize or condition instance usage
Summary: This loss has been eaten many times, in the development of the previous SQL code, many with or as a where condition of the query, or even update. Here are examples of the drawbacks of using or, and the ways to improve them. select f_crm_id from d_dbname1.t_tbname1 where f_xxx_id = 926067 and (F_mobile&n ...
2. Recommended 10 articles on methods and functions
Summary: In MySQL applications, dates and queries are very common. For example, to check the data for a certain day, a week, or a month, query the difference between two dates, query the day of the week, and so on. Here's a look at the relevant MySQL time and date functions, and how they are used. Now () function does MySQL have a getdate () function like MSSQL? Yes, it is now (). mysql> Select now (); +------------...
3. Summarize the Filter class instance usage tutorial
Introduction: What is SQL injection? My understanding of SQL injection is that some people can use malicious parameters input, let the background execute this SQL, and then achieve the purpose of obtaining data or destroying the database! For a simple query example, the background SQL is spliced: SELECT * from Test where name=& #39; + parameter passing +& #39; The front page asks for name, so the hacker can enter: & #39;;D ROP TABLE test;-- Don't underestimate the passage of s ...
4.10 Articles about table information recommended
Summary: MySQL metadata you may want to know MySQL the following three kinds of information: query result information: The number of records affected by the SELECT, UPDATE, or DELETE statement. The information: of database and data table contains the structure information of database and data table. MySQL server information: contains the current status of the database server, the version number, and so on. In the MySQL command prompt, we can easily get the above server information. But if you use a scripting language such as Perl or PHP, you'll need to call ...
5.10 recommended courses on retrieving information
Summary: SELECT statements are used to retrieve information from a data table. The general format of the statement is:select what_to_select from which_table Where conditions_to_satisfy;what_to_select points out what you want to see, which can be a table for a column, or * denotes "all columns." Which_table indicates the table from which you want to retrieve data. The WHERE clause is available ...
6. About the CAST function article recommendation
Summary: The binarybinary operator throws the following string into a binary string. This is a simple way to promote column comparisons by byte-by-bit rather than by character-by-word. This makes the comparison case-sensitive, even if the column is not defined as Binary or Blob. Binary also produces a trailing gap, which makes it more visible. mysql> select & #39;a& #39; = & #39; a& #39;; ->&nb
7. Summarize the 10 examples of concurrency control tutorial
Introduction: First, pessimistic lock 1, exclusive lock, when the transaction in the operation of data to lock this part of the data, until the operation is completed and then unlocked, other transaction operations to operate the part of the data. This prevents other processes from reading or modifying the data in the table. 2, realization: In most cases rely on the database lock mechanism to achieve generally uses select ... for update to lock the selected data, such as SELECT * Fr ...
8. Recommended 10 ways to prevent SQL injection
Introduction: (1) mysql_real_escape_string-escapes special characters in strings used in SQL statements, taking into account the current character set of the connection how to use it:? 123$sql= "SELECT COUNT (*) Asctr from users where Username= ' ". Mysql_real_escape_string ($username)." ' Andpassword= ' ". Mysq ...
9. Related article recommendations for numeric operators
Introduction: For ordinary addition and subtraction operation, here is not explained in detail, the following example:mysql> select 3+4;+-----+| 3+4 |+-----+| 7 |+-----+1 row in set (0.03 sec) Ceil and Floorceil for rounding up, only ...
10. Summary of Points of view update notes
Summary: The updatable nature of a view is related to the definition of a query in a view, what are those in MySQL trying to make non-updatable? The following types of views are not updatable 1. An SQL statement that contains the following keywords: aggregate function (sum, MIN, Max, count), distinct, group by, having, union, or Uinon all2. Constant View 3.select Contains sub-query 4.join5.from a non-updatable subquery that attempts 6.where words references the From ...
"Related question and answer recommendation":
JavaScript-click the Select box option Pop-up Ngdialog Click Cancel when you close the popup box and you want the value of the Select box to be the same
Angular.js How to bind data when editing data after saving?
Java-The following code, jquery gets the value of select is always incorrect
Ruby-datamapper How do i specify a table name?
Javascript-html Select how to modify the style, the mouse hover when the option style, there is no plug-in AH