This chapter introduces the MySQL relational database management system (RDBMS) and its Structured Query Language SQL ). This article provides the basic terms and concepts that should be mastered, introduces the sample database used in this book,
PhpMyAdmin is a MySQL management tool. Through this program, you can directly manage MySQL from the web without running it on the system.Installation steps:1. The only difference between obtaining the archive samples //
In the new SQL statement, the command for declaring the variable in the composite statement is DECLARE.
(1) Example of two DECLARE statements: create procedure p8 () BEGINDECLARE a INT; DECLARE B INT; SET a = 5; SET B = 5; insert into t VALUES (a);
FreeBSD 4.x or newer is recommended for running MySQL, because the thread package is much more integrated. To get a secure and stable system, you shoshould use only FreeBSD kernels that are marked-RELEASE.
The easiest (and preferred) way to install
MySQL introduced the trigger from version 5.0.2. The trigger is a named database object, which is related to a table. When a specific event occurs in this table, the trigger is activated to execute corresponding actions. The trigger allows these
Most people run a single MySQL server on a specified machine, but in some cases, running multiple servers is advantageous: you can test the new version of server when the finished server is running. In this case, different servers will run.
The
MySQLForCOUNT (*)For example,
Execute: select count (*) FROM tablename. Even for mysql with tens of millions of data, results can be returned very quickly.
Run: select count (*) FROM tablename WHERE ....., Mysql query time began to rise.
Online
MySQL parameter DELAY_KEY_WRITEThe related knowledge is what we will introduce in this article. DELAY_KEY_WRITE refers to the update operation of the table to the disk without updating the index to the disk before the table is closed, record the
Previously we introduced:MySQLDatabaseTIMESTAMPSet the default value for flexible use, this next time we will introduce several MySQL database TIMESTAMP set the default value of several application instances, hope to help you.
#1 check the table
Normal Syntax:Copy codeThe Code is as follows:Select * from table_name t where t. field1 in (1, 2, 3, 4 ,...); When the list in the write stored procedure in is substituted with an input parameter, the following method is required:The find_in_set
1. The most common paging Method for MYSQL:Copy codeThe Code is as follows:Select * from content order by id desc limit 0, 10In the case of small data volumes, such SQL statements are enough. The only problem that needs to be paid attention is that
1. Modify the localization timePrinciple: gettext is required to format the localization time. If this function is not enabled in your environment, garbled characters are returned, affecting the processing of phpmyadmin ajax. this test is passed in
There is a table whose id is the primary key. In this way, a record can be returned:Copy codeThe Code is as follows:"SELECT * FROM t HAVING id = MIN (id );"However, if you replace MIN with MAX, the returned result is null:Copy codeThe Code is as
The basic update syntax is to update the table set field = value where field = xxx
Existing Material Table materials (y_name, y_quantity), product Table a (p_name, p_quantity), to summarize the materials used by product a to materials
Mysql is not
Due to the adjustment of the company's business and application, many tables in Mysql are not needed before, so we need to sort out the database.
At the beginning, I was wondering: Will some tables be deleted? A good solution. Just write a simple
1. Phantom read. Many books and blogs have mentioned that mysql tx_isolate (transaction isolation) is repeatable read. Mysql does next-key lock to prevent phantom read. However, if you use
SELECT * from [table];
SELECT * from [table] for
Recently, I decided to view the stored procedures written by my colleagues in the past, find some places where the code is not well written, and try to make modifications to make these processes run at a good speed. The following are the most common
Problem SQL Background: if the project has six tables, the corresponding brand_id field should be written according to the pid field. However, there are two tables of tens of millions. After my worker is running, the online mysql master-slave
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