Constraints, multi table relationships, and multi table joins

constraint Constraint is to restrict the fields, so as to ensure the accuracy, effectiveness and integrity of the data. Multiple constraints are separated directly by spaces # Create a student table and set constraints for each field create table student( id int primary key auto_increment, name varchar(10) not null unique ...

Added by markts on Mon, 28 Feb 2022 17:07:49 +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

[deep analysis of Spring source code] 07 database link JDBC

1. Implementation of spring connection database (JDBC) Spring has done a lot of encapsulation for JDBC, eliminating redundant code and greatly reducing the development cost. Let's learn about the operation of JDBC in spring through an example. 1) Create data table structure CREATE TABLE user ( id int(1) NOT NULL auto increment, name v ...

Added by Rovas on Sun, 27 Feb 2022 11:52:56 +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

MySQL uses binlog logs to solve the problem of deleting databases and tables

First, create a simulation environment. mysql> create database testdb; mysql> use testdb; mysql> CREATE TABLE `people` ( `name` varchar(20) DEFAULT NULL, `age` varchar(20) DEFAULT NULL, `birth` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; mysql> CREATE TABLE `pet` ( `name` varchar(20 ...

Added by bonkaz on Sun, 27 Feb 2022 09:00:39 +0200

Redis 06 redis Zset structure and Application

1 zset zset (ordered set) is the most frequently asked data structure in Redis. This ordered set is similar to the set container of C + +, but the underlying structure is different. The underlying structure of C + + is implemented using RB tree (red black tree). Unlike zset, which is implemented using a hop table. On the one hand, zset ensure ...

Added by svenski on Sun, 27 Feb 2022 07:16:40 +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

Use of Java - jdbc

Chapter 1 JDBC overview Before that, we learned JavaSE and wrote Java programs. The data is stored in variables, arrays, sets, etc., which cannot be persisted. Later, we learned that IO streams can write data to files, but it is not convenient to manage data and maintain the relationship between data; Later, we learned the database manage ...

Added by dcro2 on Sat, 26 Feb 2022 16:47:26 +0200

I'm learning database function at station b

Previous: I'm learning database at station b (8): multi table operation exercise Function classification Aggregate function, mathematical function, string function, date function, control flow function, window function 1, Aggregate function 1. Introduction Aggregate functions are mainly composed of count, sum, min, Max and AVG. these aggregat ...

Added by dpronk on Sat, 26 Feb 2022 14:11:32 +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