Use examples:
A field (purview) in the user table represents the user's permissions
Save all of the user's permission IDs in this field. For example, there are five privileges such as 1,2,3,4,5
Find out which users have permissions with a
To replace some of the content in a field, you can use the UPDATE statement:
UPDATE table name SET field name = replace (field value before substitution, ' replace keyword ', ' replace keyword ') WHERE field name REGEXP "field value before replace"
MySQL's storage engine MyISAM and InnoDB as well as memoryMemory will introduce the following
InnoDB supports things, foreign keys and row locks, MySQL does not support
InnoDB does not support types of fulltext indexes
InnoDB does not save the exact
MySQL update some of the data in the field in the first case:
Copy Code code as follows:
Update tab SET A = concat (substring (a,1,3), ' BBB ');
Starting with the 1 characters of a, 3 characters, plus ' BBB ', and writing to a, if a
1> query data table except the first three data.
At first, I thought of this statement.
SELECT * FROM admin WHERE userid to (select UserID from admin order by UserID LIMIT 3) Order by UserID DESC
But the runtime will report this version of MySQL
When I was using the MySQL client, it occurred to me that it would be nice to add rankings to the query results and then find a simple solution.
The following is a sample table of data:Then we're going to sort and rank according to the Roll_no
Copy Code code as follows:
SELECT A. ' Table_schema ' as db_name, a. ' table_name ', A. ' Table_rows ', A. ' ENGINE '--, a.*
From
Information_schema. ' TABLES ' a
Left JOIN information_schema. ' Table_constraints ' b
On a. ' table_name ' =
DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.Mysql> Select DayOfWeek (' 1998-02-03 ');-> 3
Weekday (date)Returns the week index of date (0= Monday, 1 =
Often the application needs to flip the data in the table, and if the volume of data is large, it often poses a performance problem:
Root@sns 07:16:25>select Count (*) from reply_0004 where thread_id = 5616385 and deleted = 0;
+ ———-+
|
We know that we can put a large number of records of MySQL big table according to the primary key, Time field, conditional field, etc. into several tables and even saved in several servers.The only problem is that the query is cumbersome across
For example, an article table Article (id,category,insertdate), now use SQL to find the most recent time in each type of the first n data composition of the collection, a good code, to retain the standby
Select a1.* from
Article as A1
Write down the two ways PHP connects to MySQL.
Mock the data first, and you can execute SQL.
/* CREATE DATABASE * *
IF not EXISTS ' test ';
/* Select database * * Use
' test ';
/* CREATE TABLE
/IF not EXISTS ' user ' (
name varchar, age
The primary key in a table originally was an int self-growing type,Because business changes require an int to be converted to a CHAR-type primary key. Also, because the data already exists in the original table, you cannot delete the table rebuild,
Because when you do a project you need to filter out parts of the product list so that it is at the end of the list, but all products are sorted by update time.
After studying the database structure of the system, decide that the product that will
Query is the core of the database, the following for you to introduce MySQL multiple table query How to achieve, if you are in the MySQL multiple table query has encountered problems, may wish to see.
mysql multiple table query:
Copy Code
This time I'm going to add a database to my Python program, mainly to get the data from MySQL and display it on the page.
The first is the MySQL profile config.py
Host= "127.0.0.1"
user= "root"
password= "" charset= "UTF8" database=
Looking for some information, and then I used the MySQL string processing of two functions concat () and left ()
1, CONCAT (str1,str2,...)
Returns a string from the argument's link. Returns null if any argument is null. can have more than 2
Recent server problems have caused the company's website data to be lost a lot. The wisdom of the soft also lost a lot. I've been working on this for the last few days. Repair data.
It's time to restore a customer's data today. Found a consistent
Today's classmate asked me about this SQL statement, I deliberately remember, after all, this is also more common
Copy Code code as follows:
SELECT * FROM Member_payment
ORDER BY id DESC] T GROUP by member_id limit 10
The
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