The concept of null values is a common cause of confusion among novice sql, who often assume that null is the same thing as an empty string. That's not true! For example, the following statements are completely different:
Mysql> INSERT into my_table (phone) VALUES (NULL);
For beginners of SQL, the concept of null values often creates confusion, and they often assume that null is the same thing as an empty string. This is not the case. For example, the following statements are completely different:
Mysql> INSERT into my_table (phone) VALUES (NULL);
MySQL adds, modifies, and deletes the column bitsCN.com.
View constraints in MySQL, add constraints, delete constraints, add columns, modify columns, and delete columns
View the table field information: desc table name;
View all table information: show create table name;
Add primary key constraint: alter table name
Tags: values INF name Force pre not BSP tab throughnonempty constraint NOT NULL constraint:Forcing a column to not be a NULL value, the Constraint force field always contains a value. This means that if you do not add a value to the field, you cannot insert a new record or update the record. 1. Create a not null const
In MySQL, the processing of NULL fields, it is important to note that when there is null in the processing query condition, it is possible that the value you get is not desired because, in MySQL, the null value equals (=) is judged equal (=) or unequal (! =) will return FALS
Mysql tutorial is null usage
Note that in mysql, 0 or null means false while other values mean true. The default true value of Boolean operations is 1.
The special processing of null is in the previous chapter. To determine which animal is no longer alive, use death is not
encountered when executing SQL statements in the MySQL database: NULL values are not necessarily set to null. During the operation, the data is clearly inserted with a null value, but the final query result is not a null value.
In MySQL
| Message |+-------+------+--------------------------------------------------------------------------+| Note | 1292 | Incorrect date value: ' 2018-05-11 11:18:41 ' for column ' date_2 ' at row 1 |+-------+------+--------------------------------------------------------------------------+1 row in Set (0.00 sec)Prompt for the date type to insert the alarm, but can still be inserted, because the date type is only recorded (YYYY-MM)Query OK, 1 row affecte
result shows the current time of the inserted record. What is this? In fact, this is a common trap encountered when executing SQL statements in the MySQL database: NULL values are not necessarily set to null. During the operation, the data is clearly inserted with a null value, but the final query result is not a
How does MySQL dynamically add a pruning column field, as sql:
Dynamically add column fields:
ALERT TABLE table1 Add transactor varchar (a) not Null;
To delete a column field dynamically:
ALERT TABLE tablename drop column fiel
What is the relationship between MySQL column type selection and query efficiency? Next we will show you how to select the MySQL column type. If you are interested in this, take a look.
To select a MySQL column type that helps mak
Mysql auto-incrementing primary key-return method bitsCN.com
Recently, it has always been a headache to initialize data for the current project, and the auto-increment of database IDs is getting bigger and bigger, so we need to re-start auto-increment from 1: use the following method:Method 1: if no data is needed, you can directly clear all data and restore the auto-increment field to count from 1.Truncate table name Method 2: set the current value
executing SQL statements in the MySQL database: NULL values are not necessarily set to null. During the operation, the data is clearly inserted with a null value, but the final query result is not a null value.
In MySQL databases
, the 5.6.9 is not recognized as an auto-extended primary key column, and the switch from the 5.6.9 start optimizer use_index_extensions=on is a primary key column that can recognize the extension . so it is advantageous to join the primary key column in a Level two index. This can also be done regardless of version, so that all
necessarily set to null. During the operation, the data is clearly inserted with a null value, but the final query result is not a null value.
In MySQL databases, NULL represents a special meaning for some special types of columns, not just a
to null. During the operation, the data is clearly inserted with a null value, but the final query result is not a null value.
In MySQL databases, NULL represents a special meaning for some special types of columns, not just a NULL
MySQL Query processing of NULL
There is a field blist. if you query where blist
Answer:
Null values cannot be compared using common arithmetic operators, so they are not returned for anything. You can only add where blist
In SQL, the NULL value is always FALSE when any other value or even
The MySQL database provides two types of indexes, and if not set correctly, the efficiency of the index will be greatly compromised.CREATE TABLE Test (ID INT not NULL, last_name char (+) NOT NULL, first_name char (+) NOT NULL, P Rimary KEY (ID), INDEX name (Last_name,first_name));The above is actually a multi-
MySQL single-column index is what we often see in MySQL database, the difference between MySQL single-column index and composite index may be a lot of people do not know very well, the following for you to analyze the main differences, for your reference to learn.To visually
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.