Where 1 = 1? In SQL, writing such a sentence is the same as not writing it.
Select * from table1 where 1 = 1 is no different from select * from table1, and there are even many other statements, 1 <> 2, 'A' = 'A ', 'A' <> 'B' has only one purpose.
Recently, I picked up Mysql again in the development project and encountered Chinese garbled characters when setting up the environment. I will share with you the solution below.1. show VARIABLES like 'character _ % '; shows all settings. Set the
Database Engine Introduction
The MySQL Database Engine depends on how MySQL is compiled during installation. To add a new engine, you must recompile MYSQL. By default, MYSQL supports three engines: ISAM, MYISAM, and HEAP. The other two types of
-- Note: personal study notes are displayed in the ascending order of BANK_ID + OP_DATE.Copy codeThe Code is as follows:-- Test DataCreate table # TB (id varchar (10), BANK_ID VARCHAR (10), OP_DATE VARCHAR (10), OPERATOR_NO VARCHAR (20), amt decimal
The prompt command displays the current user, database, time, and other information at the mysql prompt.Copy codeThe Code is as follows:Mysql-uroot-p -- prompt = "\\ u \\ h :\\ d \\ r :\\ m :\\ s>"After the setting is successful:Copy codeThe Code is
MyISAM is the default storage engine of MySQL. MyISAM does not support transactions or foreign keys, but it has fast access speed and has no requirements on transaction integrity.The InnoDB Storage engine provides transaction security with commit,
An index is a structure created on a table that sorts values of one or more columns in a database table.
The main function is to increase the query speed and reduce the performance overhead of the database system.
Through the index, the query data
Mysql storage engine myisam, innodb, and memoryMemory will be introduced laterInnodb supports transactions, foreign keys, and row locks. mysql does not.Innodb does not support fulltext index typesInnodb does not save the specific number of
Recently, many SQL statements are written in the project, and variable assignment is often used, and I use SET and SELECT to achieve the effect.What is the difference between the two? When and which one?After online queries and personal exercises,
After installing MySQL, you will receive the following prompt:[Root @ localhost Desktop] # rpm-ivh MySQL-server-5.5.28-1.rhel5.i386.rpmPreparing... ######################################## ### [100%]1: mySQL-server ###################################
In the second set
1. show status like 'com % 'is equivalent to show status session like 'com %' for a hundred years -- display the current console statusShow global status like 'com % '-- displays the number of times the database has been started
1.
Right-click the project (not Src) and choose -- Build Path -- Add External Archives. Select the jar package under the driver. This is the release version and the debug version under the bin directory.
The example is in connector-j.html under docs.
You can obtain an alias for the table and field during query. This alias can replace the specified table and field.
Alias for tableCopy codeThe Code is as follows:Mysql> SELECT * FROM department d-> WHERE d. d_id = 1001;+ ------ + ----------- + -----
Join query connects two or more tables according to a certain condition and selects the required data.
When different tables have fields of the same meaning, you can use these fields to connect these tables.
Reference Table: employee
Reference
Reference Table
Count () is used to count the number of recordsCopy codeThe Code is as follows:Mysql> select count (*) from score;Mysql> select count (*) from score where stu_id = 901;
Sum () summation FunctionCopy codeThe Code is as follows:Mysql>
To replace part of a field, use the update statement:UPDATE table name SET field name = REPLACE (REPLACE the previous field value, 'replace the previous keyword ', 'replace the previous keyword') WHERE field name REGEXP "REPLACE the previous field
Source: mysqlpub.com
MySQL has two functions to calculate the number of rows affected by the previous statement. Unlike SqlServer/Oracle, do not cause functional problems due to this difference:
1. Use the found_rows () function to determine the
During the development process, you cannot avoid spam or a series of problems caused by spam. Garbled characters are the cause of character sets. They generally do not have much to do with the logic. That is to say, there is no problem in the
When creating a temporary table, you can use the temporary keyword. For example:Copy codeThe Code is as follows:Create temporary table tmp_table (name varchar (10) not null, passwd char (6) not null ); OrCopy codeThe Code is as follows:Create
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.