ID SID CID1 1 12 1 23 2 1To the SID group, the last to take the largest CID, the above to take 2nd, 31 method One:2 Select * from(Select * fromTableOrder byCiddesc) asAGroup byA.sid3 4 Method Two:5 SelectA.* fromTable asAwhereCid=(Select
CREATE PROCEDURE Sys_message_user_for_busbase () Begin-Declares a flag done that is used to determine whether the cursor is traversing the completion of the DECLARE do INT DEFAULT 0; --Declare a variable to hold the data extracted from the
A where subquery is the result of an inner query as a comparison condition for the outer layer of SQL.Select goods_id, goods_name from goods where goods_id = (select Max (goods_id) from goods);The inner query is select MAX (goods_id) from goodsThe
The Format expression field description for the From_unixtime function in MySQL:%M month name (January ... December)%W week name (Sunday ... Saturday)%d The date of the month with English prefixes (1st, 2nd, 3rd, etc.). )%Y year, number, 4-digit%Y
Ubuntu uses apt-get after installing MySQL, the server's default encoding is Latin1, the following changes the server's code to UTF8.View MySQL and encoded informationLook at the MySQL message:Mysql> select version ();
DDL statements (DDL: Data definition Language)1. Creating the database: Create databases test1;2. Display database: show databases;3. Select database: Use MySQL;4. Query the database for all tables: show tables;5. Delete databases: drop database
There are two ways that MySQL can be implemented in multiple instances, both of which have pros and cons.The first is to use multiple configuration files to launch different processes to implement multiple instances, the advantages of this method is
1, modify the configuration file My.ini Set encoding method is Utf-8[Client] default-character-set=UTF8 [mysqld]character-set-server=UTF8 collation -server=utf8_general_ci init_connect= ' SET NAMES utf8′Restart MySQL, and then enter it at the
Vertical Sub-table:In fact, there is nothing to say, that is, the primary key + common columns in the original table , and then the primary key + some non-commonly used columns placed in another table .Such a data page can hold more data.
1, query The database show databases;2, query the database table show TABLES; Show TABLES from db;3, query table Index Show index from table4, query table column show [full] COLUMNS from tb1 from Db_test; Show [Full] COLUMNS
1. Benefits of starting multiple MySQL on a single machineFully utilize the computing power of a single machineCan effectively allocate different logic to different MySQL to improve the database parallel processing abilitySingle-machine can also be
MySQL may have this error when performing a delete, update, such as you wrote a SQL similar to the following:UPDATE SET Col=col+1where in (SELECTfromWHERE Othercol=0)OrDELETE from WHERE inch (SELECTfromWHERE othercol=0)This time will appear table '
1, Space (N) output spaceSELECT SPACE (5);""2, replace (STR,FROM_STR,TO_STR) said Str in from_str replaced by to_strSELECT REPLACE (' http://www.baidu.com.cn ', ' Baidu ', ' Google ');http://www.google.com.cn3, repeat (str,n) repeat output N times
MySQL has a variety of storage engines, MyISAM and InnoDB are two of the most common. Here are some basic concepts about these two engines (not in-depth introduction).MyISAM is the default storage engine for MySQL, based on the traditional ISAM type,
Mysql date and time processing functions
ADDDATE (date, interval expr unit), ADDDATE (expr, days) --- add the time value (Time Zone) as the date value, which is the alias of DATE_ADD ()
DATA_ADD (date, INTERVAL expr unit), DATE_SUB (date,
Install mysql In debian
Apt-get install mysql-client mysql-server
In the middle, you will need to set the password. After the password is set, mysql will be automatically started.
You can use ps-ef | grep mysql to view related mysql processes.
Mysql creates a table based on the query results
Assume that three tables exist.
S (sno, sname. sex, age, dept) // sno indicates the student's student ID, sname indicates the student's name, sex indicates the gender, age indicates the age, and
10 configurations that must be adjusted after MySQL is installed. After mysql is installed
Source: mysqlperformanceblog Source: Open Source China welcome to share original to bole headlines
When we were hired to monitor MySQL performance, people
MySQL cursor operation guideThis article provides a detailed analysis of the usage of MySQL cursors. For more information, see
Test Table level
The Code is as follows:
create table test.level (name varchar(20));
Insert some
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service