MySQL multi table & transaction notes
1. Multi table query:
1. Query syntax:
select
Column name list
from
Table name list
where....
2. Prepare sql
Create department table
CREATE TABLE dept(
id INT PRIMARY KEY AUTO_INCREMENT,
NAME VARCHAR(20)
);
INSERT INTO dept (NAME) VALUES ('Development Department'),('Marketing Department'),('Finance Department');
Create employee tabl ...
Added by Celadon on Fri, 04 Mar 2022 10:13:52 +0200
[mysql] multi table query
multi-table queryMulti table query, also known as association query, refers to two or more tables completing the query operation together.Prerequisite: these tables queried together are related (one to one, one to many). There must be an associated field between them. This associated field may or may not have a foreign key. For example: employe ...
Added by vargefaret on Fri, 04 Mar 2022 07:09:59 +0200
MySQL -DML data operation language
DML language
Data operation language:
Inserting: insert ing Modify: update Delete: delete
1, Insert statement
Mode 1: Syntax: insert into table name (column name...) Values (value 1,...); Features: it supports inserting multiple rows and querying subsets
SELECT * FROM beauty;
1. The type of the inserted value should be consistent or com ...
Added by aeonsky on Fri, 04 Mar 2022 03:55:35 +0200
Chapter 15 stored procedures and functions
Chapter 15 stored procedures and functions
MySQL supports stored procedures and functions from version 5.0. Stored procedures and functions can encapsulate complex SQL logic. Applications do not need to pay attention to the complex SQL logic inside stored procedures and functions, but simply call stored procedures and functions.
Overview of s ...
Added by tmed on Mon, 28 Feb 2022 18:25:13 +0200
MySQL advanced summary
MySQL UPDATE multi table Association update
1.MySQL can UPDATE data based on multi table query. For the UPDATE operation of multiple tables, you need to be careful. It is recommended to use the SELECT statement to query and verify whether the updated data is consistent with your expectations before updating.
Build two tables, one for prod ...
Added by fisel on Mon, 28 Feb 2022 08:11:11 +0200
Database review: SQL statement sorting
SQL Statement Review
1.Data Definition Construct
1.1 Create table Construct
1.1.1 table creation statement
create table instructor
( ID char(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
);
-----------------------------------
create table r
( A1 D1,
A2 D2,
...
An,Dn,
(integrity-constraint_k)
);
1 ...
Added by mark_18 on Sun, 27 Feb 2022 10:19:59 +0200
Mybatis - dynamic SQL, paging plug-in
Dynamic SQL
introduce
In the mapping file of Mybatis, our SQL is relatively simple. Sometimes when the business logic is complex, our SQL changes dynamically. At this time, our SQL can not meet the requirements in the previous study.
The official document on dynamic SQL reference is described as follows:
Previous problems
Example of mult ...
Added by miniature on Sat, 26 Feb 2022 22:34:36 +0200
Gap Lock in MySQL InnoDB
Lock List
Shared and Column Exclusive LocksIntent LockRecord LockGap lockNext-Key LockInsert Intent LockAUTO-INC lock
This time we will only discuss and experiment with intent locks.
Gap lock
Gap locks are also index records of locks, locking values that do not exist in gaps.
What is gap lock? Gap locks are locks on gaps between index rec ...
Added by ksukat on Sat, 26 Feb 2022 20:12:27 +0200
Manage hierarchical data in MySQL - adjacency table model and nested set model
backgroundIn our daily development, one kind of data we will come into contact with is hierarchical data. What is tiered data? Business organization chart, content management category, RBAC permission management, product category, etc. These are hierarchical data. The following is the product category hierarchy of an e-store:In this paper, we w ...
Added by bad_gui on Sat, 26 Feb 2022 17:36:42 +0200
JDBC learning notes
Supplement 4 When the connection is closed by default, we will submit it automatically,
Each rollback is rolled back to the previous submission
Transfer operation without considering database transactions
When we finished the first transaction, we committed. As a result, an exception occurred, resulting in a direct exit. The subsequent t ...
Added by Al42 on Sat, 26 Feb 2022 10:04:50 +0200