Mysql modifies columns, adds columns, deletes common column commands, and mysql commands
Alter table: add, modify, and delete TABLE columns, constraints, and other TABLE definitions.
View column: desc table name;
Alter table t_boo
For SQL beginners, the concept of NULL is often confused. They often think that NULL is the same as the NULL string. This is not the case. For example, the following statements are completely different:
Mysql> insert into my_table (phone) VALUES (NULL );
Label:This article transferred from: http://blog.csdn.net/lovelyhermione/article/details/4580866 The MySQL database provides two types of indexes, and if not set correctly, the efficiency of the index is compromised but the problem is completely unknown. CREATE TABLE Test (
ID INT NOT NULL,
last_name CHAR (+) not NULL,
First_ Name CHAR
has two fields: User_id (whose data type is int) and Date (whose data type is TimesTamp ). Insert a record to this table, and insert a NULL value to the Date field. However, when we query, the 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 va
Tags: MySQL data table column type and column constraintsMySQL data table when defining columns, you need to determine the data type of the column, as well as the related properties of the column or constraints, then the MySQL
MySQL single-column index is often seen in MySQL databases. many people may not fully understand the differences between MySQL single-column index and Composite Index. The following describes the main differences between the two, for your reference. To visually compare the t
Mysql column-to-row and column-to-row
Today, I saw a row-to-column and column-to-row problem when I went around Java. After reading this, I really don't know how to do it. I may usually use hibernate as the persistent layer, the SQL statement won't be written either. Hurry u
Label:Transferred from: http://blog.chinaunix.net/uid-29305839-id-4257512.htmlCreate a multi-column index:CREATE TABLE Test (ID INT not NULL,Last_Name CHAR (+) not NULL,First_Name CHAR (+) not NULL,PRIMARY KEY (ID),INDEX name (last_name,first_name));To create multiple indexes:CREATE TABLE Test (ID INT not
The default value of a column in mysql is another column. Is there a solution? gt; ipvarchar (20), namevachar (20) I want to fill in the ip address value when the insert statement does not give the name value, that is, how to write the NOTNULLDEFAULTVALUE. Is there a way? ------ solution ------------------ why can't the program process it, pre-processing data be
more disk space, and has no advantage over virtual column, so MySQL 5.7 does not specify the type of generated column, which by default is virtual column. In addition
Stored generated column performance is poor, see here
If stored generated
Tags: mysql row to columnI read a blog post very well, it is easy to understand after reading, the post address is: http://www.cnblogs.com/lhj588/p/3315876.htmlRecently I met a friend in the group and said, so record:Assume that the table name is T. There are six fields in the list p1,p2,p3,s1,s2,s3Now wantSum of S1 values when p1=100Sum of S2 values when p2=100Sum of S3 values when p3=100To create a table:CREATE TABLE ' t ' (
' id ' int (one) not
Explain can analyze the execution of select statements, that is, the execution plan of MySQL. The type column MySQL finds the required rows in the table. Including (from left to right, from worst to best): | All | index | range | ref | eq_ref | const, system | null | MySQLexplain
Explain can analyze the execution of se
Label:listed below:1. Add a fieldALTER TABLE user add COLUMN new1 VARCHAR default null;//Add a field that defaults to nullALTER TABLE user add COLUMN new2 VARCHAR (a) not NULL; Add a field that cannot be empty by default2. Delete a fieldALTER TABLE user DROP COLUMN new2; Del
column length is 0 or greater than 14, and the column length is forcibly defined as 14. The column length ranges from 1 ~ The dimensions of odd values in the range of 13 are forced to be the next larger even number. All TIMESTAMP columns have the same storage size. The full precision (14 bits) of the specified period time value is used to store valid values rega
'. MySQL displays DATETIME values in 'yyyy-MM-DD HH: MM: ss' format, but allows you to assign values to DATETIME columns using strings or numbers.
TIMESTAMP [(M)]A time stamp. The value range is '2017-01-01 00:00:00 'to a certain time on January 1, 1970. MySQL uses YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD to display the TIMESTAMP value, depending on whether M is 14 (or omitted), 12, 8, or 6, howev
MySQL's understanding and tutorial on NULL value, mysqlnull
The concept of NULL value is a common cause of confusion among SQL beginners. They often think that NULL is the same as an empty string. No! For example, the following statements are completely different:
mysql> INSERT INTO my_table (phone) VALUES (
Several issues related to NULL values in MySQL Databases
For SQL beginners, the concept of NULL value is often confusing. They often think that NULL is the same as the NULL String. This is not the case. For example, the following statements are completely different:
For SQL beginners, the concept of NULL value is often confusing. They often think that NULL is the same as the NULL String. This is not the case. For example, the following statements are completely different:
Mysql> insert into my_table (phone) VALUES (NULL );
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.