Detailed description of mysql row-to-column and column-to-row instances, mysql instances
Mysql row-to-column and column-to-row
It is not difficult to explain the statement. When you loo
For MYSQL column types, refer to this appendix to introduce each column type provided by MySQL. For more information about how to use each type, see chapter 2nd. Unless otherwise specified, the listed types already exist in MySQL3.21.0.
The following conventions describe the type name:
Brackets.
M maximum display width
1, the first Data training Xltrabackup backup, be prepared, remember to remember!2.Mysql-uroot-pd********--export CSV file use dsideal_db; MariaDB [dsideal_db]> SELECT * fromT_resource_info into OUTFILE"/usr/local/mysql/t_resource_info.txt"Fields TERMINATED by','Optionally enclosed by'"'LINES TERMINATED by'\ n'; Query OK,1582463Rows Affected (29.97sec) 3, slicing CSV file, so batch import faster, more conve
second) when you insert and update data ), however, during your query, MySQL returns 8-bit year, month, and day data. If you use alter table to broaden a narrow TIMESTAMP column, previously "concealed" information will be displayed.
2. Similarly, narrowing down a TIMESTAMP column will not cause loss of information, ex
operations. Short strings run faster than long strings, and consume less disk. The fixed length type has better performance than the variable length type.What kind of comparison do you want? Strings can be case-sensitive or case-insensitive. The selection also affects sorting because it is based on comparison.Are you planning to index columns? If you plan to index a column, your selection of the column typ
Tags: update self-increment column1. Description(1) For the MyISAM table, if you update the self-increment column with update, an error occurs if the column value repeats with the existing value, and if it is greater than the existing maximum, the auto_increment of the table is automatically updated and the operation is safe.(2) for the InnoDB table, the Update Auto_increment field, if the
This article describes how to understand and use the NULL value in MySQL, A friend may refer to the concept of NULL value as 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:
Reset (80), usethefollowingSQLstatement: ALTERTABLEcontactsADDemailVARCHAR (60); Thisfirststatementwilladdtheemailc
To add a column called email to the contacts table created in Create a basic MySQL table with a datatype of VARCHAR (80), use the following SQL statement: alter table contacts ADD email VARCHAR (60); This first statement will add the email c
To a
col3 FROM table_name GROUP BY col1,col2 WITH ROLLUP HAVING col1 IS NOT NULL ) AS A GROUP BY col1 WITH ROLLUP;
NOTE: with rollup is used for column summation; SUM (IF (col2 = 'Total', col3, 0) AS total is used for summation on rows.
(3) when the second field is determined, use
select ifnull(col1,'total') AS col1, sum(if(col2='B1',col3,0)) AS B1, sum(if(col2='B2',col3,0)) AS B2, sum(if(col2='B3',col3,0))
Add a column with a specified position to the MySQL table, and specify a position in the mysql table.
ALTER TABLE test ADD COLUMN id INT UNSIGNED NOT NULL auto_increment PRIMARY KEY FIRST
Adding columns to a table is a common ope
The Mysql database provides two types of indexes. If they are not correctly set, the index utilization efficiency will be greatly reduced, but the problem is completely unknown. The copy code is as follows: CREATETABLEtest (idINTNOTNULL, last_nameCHAR (30) NOTNULL, first_nameCHAR (30) NOTNULL, PRIMARYKEY (id), INDEXname (l
The Mysql database provides two types of indexes. If they are not correctly set, the
Tags: style blog http ar sp data on Div artModifying the data type of a column name or column in MySQL(2012-04-03 08:59:25)reproduced
Tags: mysql modify column name modify column data type it
Category: Da
setting not null. 3. Workaround 1) Add a new column to set the structure properties of the column. ALTER TABLE Information add column ' yyy ' varchar (255) not NULL first; -Newly added columns yyy to the first
SELECT @ SQL _mode statement to query the current mode. The default value is null (no mode is set ).STRICT_TRANS_TABLESEnable strict mode for all storage engines. The invalid data value is denied. Detailed descriptions are provided later.· STRICT_TRANS_TABLESEnable strict mode for the transaction storage engine, or enable strict mode for the non-transaction storage engine. Detailed descriptions are provided later.Strictly control how
Create a table that uses the column index: CREATE TABLE Index_test1 (ID int NOT NULL auto_increment,first_name varchar (+) NOT NULL,last_name varchar (+) NOT NULL,Primary key (ID),Index Index_first (first_name),Index Index_last (last_name)) engine MyISAM charset UTF8;Create a table that uses multiple-
Tags: Table database capability effect int sha ble mysq typeThe 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. [C-sharp]View PlainCopy
CREATE TABLE Test (
ID INT not NULL,
Last_Name CHAR (+) not NULL,
First_Name CHAR (+) not
MySQL database provides two types of indexes, if not set correctly, the efficiency of the index will be greatly compromised but the problem is completely unknown.
Copy Code code as follows:
CREATE TABLE Test (
ID INT not NULL,
last_name CHAR () not NULL,
first_name CHAR () not NULL,
PRIMARY KEY (id),
INDE
MySQL database provides two types of indexes, if not set correctly, the efficiency of the index will be greatly compromised but the problem is completely unknown.
Copy Code code as follows:
CREATE TABLE Test (
ID INT not NULL,
Last_Name CHAR () not NULL,
First_Name CHAR () not NULL,
PRIMARY KEY
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.