数据库事务
一个事务中操作多个库会造成不能所有的语句回滚成功,结论:不要在同个事务中操作多个库
DB::beginTransaction();
try {
操作1;
操作2;
DB::commit();
} catch {
DB::rollBack();
}
【资料】https://learnku.com/laravel/t/28206
sql基础教程
子句的书写顺序
- SELECT 子句 → 2. FROM 子句 → 3. WHERE 子句 → 4. GROUP BY 子句 →
- HAVING 子句 → 6. ORDER BY 子句
SELECT 语句按照子句为单位的执行顺序
FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY