Integrity constraints are imposed on fields to meet the expected results of the field. For example, a field contains a default value and cannot be null.
Directly speaking, if the inserted data does not meet the restrictions, the database management
1. Introduction
In the Web application architecture, the data persistence layer (usually a relational database) is a key core component and has a very important impact on the system performance. MySQL is currently the most widely used open-source
1. query help? Contents2. Use the merged hash value to separate BLOB or TEXT3. Number of points used for currency (decimal or numberic)4. SQL _mode?5. order by rand () limit 1000;6. Optimize show status like 'com' Com_select Com_insert and so on to
I. concept:① Database Synchronization (master-slave synchronization-write data to the slave server while writing data to the master database)② Database Synchronization (master-master synchronization-two database servers write data to each other)
Ii.
I. concept:
① Database Synchronization (master-slave synchronization-write data to the slave server while writing data to the master database)② Database Synchronization (master-master synchronization-two database servers write data to each other)
Ii.
Environment
MySQL 5.1 + command line tool
Problem
MySQL table field settings Default Value
Solution
Copy codeThe Code is as follows: -- SQL:
Create table test (
I _a int NOT NULL DEFAULT 1,
Ts_ B timestamp NOT NULL DEFAULT NOW (),
C_c char (2)
Edit the my. cnf or my. ini file and remove the comments of the following lines of code:
Copy codeThe Code is as follows: log_slow_queries =/var/log/mysql/mysql-slow.log.
Long_query_time = 2
Log-queries-not-using-indexes
This will record slow
When creating a table, we will inevitably consider the disadvantages of weeks. Therefore, we need to use the alter table statement to modify the table later.
Modify Table Name
Copy codeThe Code is as follows: mysql> alter table student rename
To operate a table, you must first select a database because the table exists in the database.
Select Database
Mysql> use school;
Database changed
After selecting the database, we can create tables in this database.
Create a table
Mysql> create
MySQL we have installed is a database management tool. What is really valuable is that data in a relational database exists in the form of tables, the aggregation of N tables becomes a database. Now let's take a look at the basic operations of the
A few days ago, I wrote a summary of Mysql cross-Table update. Today, let's take a look at cross-Table deletion.
After Mysql4.0, mysql began to support cross-Table delete.
Mysql can delete multiple table records in an SQL statement at the same time,
An error is reported when mysql statements are used today. The statement is as follows:
SQL code
Copy codeThe Code is as follows: SELECT sapcle FROM SellEnterpriseBaseInfor sebie, SellEnterpriseBaseInforVer sebive, sellapplyperpolicangelist sapcle
In Navicat for MySQL, PostgreSQL and Oracle
The error occurs because the mysql account does not have sufficient permissions to connect to the remote mysql server.
After mysql is installed, only "localhost" connections are allowed by default.
Change the Data Type of a column
[SQL]
Alter table visitor MODIFY nam VARCHAR (30 );
Append a new column
[SQL]
Alter table visitor ADD age INT;
Alter table visitor ADD age int first;
Alter table visitor ADD age int after nam;
Change column
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 values (1 );
Use db2;
On Weibo, we will discuss how MySQL can reduce MySQL hang time When deleting a large table engine = innodb (30G +). Here is a brief summary:
When buffer_pool is large (30 GB +), because the table is deleted, the entire buffer pool will be
If you back up your data, ignore it.If the data is too big, use the database client software to directly import the data into the memory, or execute SQL directly.1. Specify the file path.2. fields are separated by commas, and data rows are separated
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server www.2cto.com
Cause:Mysql only has one root user. After changing the root password, select MD5. After submission, click"Host 'localhost' is not allowed to connect
1
How to implement the following SQL query in MySQL
(Select s. Name
From student s, TRANSCRIPT T
Where s. StudId = T. StudId and t. CrsCode = 'cs305 ')
INTERSECT
(Select s. Name
From student s, TRANSCRIPT T
Where s. StudId = T. StudId and t. CrsCode
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