SQL 索引与数据库安全 INDEX1234567891011121314151617181920212223242526272829303132-- 创建索引CREATE INDEX idx_state ON customers (state);-- 查看索引-- 主键 聚集索引SHOW INDEXES IN customers;+-----------+------------+------------+------- 2023-08-29 Linux
SQL 数据库与表操作 DATABASE12CREATE DATABASE DB_NAME;DROP DATABASE DB_NAME; TABLE123456789101112131415161718192021222324252627282930313233343536373839USE DB_NAME;-- 创建表CREATE TABLE customers( customer_id INT PRIMARY 2023-08-29 Linux
SQL 数据类型 字符串类型 STRINGS123456CHAR() -- 存储固定长度字符VARCHAR() -- 存储可变长度字符 ~64KBMEDIUMTEEXT -- 存储很长的字符 16MBLONGTEXT -- 存储巨长的字符 4GBTINYTEXT -- 存储短短的字符 255bytesTXT -- 64KB 2023-08-28 Linux
Docker Run docker run重点只记一下挂载部分,其他的都比较好理解,就不展开说了。( -e 环境配置放到下次再说) 123456docker run-d 后台运行-p 端口映射——本地端口:容器端口-v 挂载——本地地址:容器地址-e 环境配置--name 容器名字 普通挂载123456789101112131415161718192021222324252627282930313233# 例 2023-08-27 Linux
SQL TRIGGER 触发器12345678910111213141516171819202122DELIMITER $$CREATE TRIGGER payments_after_insert AFTER INSERT ON payments FOR EACH ROWBEGIN UPDATE invoices SET payment_total = payment_total + NEW.am 2023-08-27 Linux
SQL TRANSACTION 事务 TRANSACTION1234567891011-- 类似于一个线程,创建以后会执行里面的SQL语句-- 下面这句用于创建线程START TRANSACTION;INSERT INTO orders (customer_id, order_date, status)VALUES (1, '2019-01-01', 1);INSERT INTO order_itemsVAL 2023-08-27 Linux
SQL PROCEDURE与函数 存储过程 Stored Procedure用来存储SQL代码,在开发时使用。 PROCEDURE12345678910111213141516171819202122232425262728293031323334353637383940414243444546-- DELIMITER 修改分隔符DELIMITER $$CREATE PROCEDURE get_clients()BEGIN 2023-08-27 Linux
SQL VIEW 表123456789101112131415161718192021222324252627282930313233-- 表clients+-----------+-------------+--------------------------+---------------+-------+--------------+| client_id | name | address 2023-08-26 Linux
SQL 函数 表12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182-- 表orders+----------+-------------+-------- 2023-08-26 Linux
SQL 复杂查询函数 表123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899-- 表invoic 2023-08-26 Linux