MySQL study Note 3: basic table operations introduction bitsCN.com to operate a table, you must first select the database because the table exists in the database
Select database
Mysql> use school;
Database changed
After selecting the database, we
Solution:
Step 1: the database and table created during restoration are in utf8 format (utf8 is recommended, of course, either gbk or gb2312)
Create database 'shegongku 'default character set utf8
Create table 'members '(
'Uid' mediumint (8)
MySQL study Note 2: Basic database operations (create, delete, and view) bitsCN.com the MySQL we have installed is a database management tool, what is really valuable is that the data in the data relational database exists in the form of tables, and
Mysqlauto_increment re-count (Let id start from 1) bitsCN.com method 1
Delete from test;
Alter table 'test' auto_increment = 1
(Benefit, you can set AUTO_INCREMENT to start with any value)
Tip: If there are many columns and data, the speed
How to query duplicate fields in a large MySQL table using bitsCN. comMySQL statements? This is a problem that many people have encountered. The following describes how to query duplicate fields in a MySQL large table for your reference.
There is a
SQL code bitsCN.com used by MySQL to query data of this week, last week, this month, and last month
Query data for the current week
SELECT name, submittime FROM enterprise where yearweek (date_format (submittime, '% Y-% m-% d') = YEARWEEK (now ());
An in-depth analysis of mysql transaction processing and table locking there are two main methods to deal with bitsCN. comMYSQL transactions.
1. Use begin, rollback, and commit to implement
Start a transaction
Rollback transaction rollback
Commit
How to solve bitsCN.com
1Replicate_do_db and replicate_ignore_db do not appear at the same time. It is prone to confusion. It is meaningless.
Replicate_Do_DB: db1
Replicate_Ignore_DB: db2
Statement mode:
Use the use statement
Use db1; insert into tb1
Mysql local database How to export data from remote database bitsCN.com written in front: recently started to use the Ubuntu system, there is really no good mysql interface program, so... can only use terminal operations.
Procedure: open Terminal,
MySQL's performance solution for deleting large tables: bitsCN.com Weibo discusses how MySQL can reduce MySQL hang time when deleting large tables engine = innodb (30G +). here is a brief summary:
When buffer_pool is large (30 GB +), because the
The mysql fuzzy search method is described on bitsCN.com. There are two methods available: The first is the most earthy method: the like statement and the second is the full-text index, search on the internet: how to get better full-text search
Mysqlerror1130hy000: Host bitsCN. comERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server www.bitsCN.com
Cause:
Mysql only has one root user. after changing the root password, select MD5. after submission, click
Mysql triggers implement data synchronization between two tables bitsCN. commysql use triggers to synchronize two tables
Currently, the local test is successful.
Assume that two local databases a and B have table1 (id, val) and table2 (id, val) in
Introduction to innodb lock classification in mysql bitsCN.com
I. innodb row lock classification
Record lock: record lock, that is, only a single row is locked.
Gap lock: interval lock. Only one interval is locked. (note that the interval here is
MySQLOrderByRand () efficiency analysis bitsCN.com recently studied the implementation of MYSQL Random extraction. For example, to randomly extract a record FROM the tablename table, the general syntax is: SELECT * FROM tablename order by rand ()
Using temporary tables in mysql replication, we know bitsCN.com that temporary tables have the following features:
1. at the SESSION level, a SESSION is automatically dropped once it is disconnected.
2. it depends on the default engine. If the
How to merge two fields in mysql: bitsCN.com for example: select (a + B) as c from table
Both types are varchar type, but the display is incorrect.
Until concat ()
Concat functions in MySQL
The following example describes how to use the concat
Implementation analysis of MySQLORDERBY bitsCN.com
The following describes two sorting implementation methods and implementation diagrams through examples:Assume that two tables, Table A and Table B, have the following structures:Sky @ localhost:
When mysql enables the skip-name-resolve mode, the method of Warning is bitsCN. com120726 11:57:22 [Warning] 'user' entry 'root @ localhost. localdomain 'ignored in -- skip-name-resolve mode. www.bitsCN.com
120726 11:57:22 [Warning] 'user' entry '
In Mysql, the Insertintoxxxonduplicatekeyupdate problem bitsCN.com. for example, if Column a is defined as unique and the value is 1, the following statements have the same effect, that is to say, if a = 1 exists in the incoming and outgoing records,
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