Find in set() function of MySQL
Grammatical explanation
FIND_IN_SET(str,strlist)
str is the string or field to query;strlist can be a list of fields and characters, multiple strings must be separated by commas, for example: '1,2,e,t'.
The function is to query whether str is included in strlist, and return null or record. If the string str is in the string list strlist compose ...
Added by thom2002 on Mon, 30 Dec 2019 20:27:18 +0200
mysql export and import table structure
--Using mysql's mysql dump to export and import table structure
--The command is as follows:
mysqldump -d -h localhost -u root -pmypassword databasename > dumpfile.sql
--Where - d means to export only table structure, not data, - h means host, - u means user, - p means password database means to export that database, and d ...
Added by geordie on Sun, 29 Dec 2019 18:56:04 +0200
Basic usage of dbutils
I used the connection pool of c3p0 here. Please refer to this link: The basic usage of c3p0
dbutils is just a tool class. If you don't use hibernate, you can consider using. Because it can greatly simplify our code
The jar package can be downloaded on the official website or here: The tool class of Java connecting database
...
Added by LordTyphon on Thu, 26 Dec 2019 22:46:04 +0200
Pit of format when inserting data in pymysql
Into the pit
Today, when inserting data into mysql, I accidentally used format and found a small pit
Let's look at a piece of code:
My data:
72 232 2022/11/01
231 233 2022/01/01
231 234 2022/12/01
Database:
+---------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | ...
Added by kev wood on Tue, 24 Dec 2019 21:02:05 +0200
mysql tree structure, get all the child ID S according to pid
Go to the code directly (note that the ID here is self increasing, and the ID of the parent is smaller than that of the child)
Create a table (for example only, you can expand other fields by yourself):
CREATE TABLE `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'menu id',
`parent_id` int(11) DEFAULT NULL COMMENT 'Par ...
Added by harryman100 on Mon, 23 Dec 2019 00:19:59 +0200
Interaction between MySQL database and python
Of course, what MySQL does not know is that the old iron self Baidu is wonderful, ha ha!
In short, MySQL is a kind of relational database management system. Different data contents are put into different data tables. Different tables can be related, corresponding or not.
The operation of data is nothing but CURD (add, delete, ...
Added by MarineX69 on Fri, 20 Dec 2019 17:33:01 +0200
python with statement combined with context manager
The so-called context manager is a class that rewrites the "enter" method and the "exit" method in a class.
We can simplify some operations through the with statement in combination with the context manager.
Use with statement and custom context manager to complete the corresponding operation of the database. The code is ...
Added by rostros on Thu, 19 Dec 2019 20:12:38 +0200
Basic Introduction and Quick Setup of DBLE Learning for Database Middleware
Introduction to the basic dble architecture
dble is a highly available and scalable distributed middleware based on mysql.The River Laker sent the nickname MyCat Plus. Open source address
Let's start with the architecture diagram, where external applications are connected via NIO/AIO.First, let's talk about what NIO/AIO is.
BIO, the traditiona ...
Added by MadDawgX on Wed, 18 Dec 2019 04:50:53 +0200
Two ways to create a database connection pool
Understanding of using DBCP and CP30 to create database connection pool (for college students, please correct if there is something wrong)
DBCP creates database connection pool
CP30C create database connection pool
Why use this first? First of all, in the early stage, I believe that many small partners will connect to the ...
Added by frost110 on Mon, 16 Dec 2019 18:43:09 +0200
SQL updates from one table to another based on ID match
I have a database of account numbers and card numbers. I match these files with files to update all card numbers to this account, so I only use the account.
I created a view that links the table to the account / card database to return the Table ID and the associated account, and now I need to update those records whose ID matches the accou ...
Added by yacaph on Mon, 16 Dec 2019 16:28:39 +0200