mysql联查sql语句
sql语句:增删改查,其中 增、删、改只用于单表多表级联删除,级联更新有时候会出现(例如:删除父类别,子类别也会被删除)多表查询:多表联查、子查询建表语句: 一般不需要语句建表,语句了解认识即可,手动...
2024.11.22需要注意的是,配置之后,每次启动都会执行一遍sql文件。但一般要求只执行一次。所以在sql语句中,处理好如果已存在的处理方式。如建表语句中加入:if not exist 判断建表。
1、文件目录2、application-dev.yml#用于开发环境server:port: 8000max-http-header-size: 8192servlet:encoding:charset: UTF-8force: trueenabled: truelogging:level:root: infospring:mvc.async.request-timeout: 20000application:name: druid-jdbc-mysqlsql:init:encoding: utf-8# mode: always - Spring Boot应用启动时始终执行数据库初始化# mode: embedded - 只初始化内存数据库,比如H2数据库# mode: never:- 从不执行初始化数据库mode: always# 数据库平台内容配置项,主要有mysql、postgresql、oracle等platform: mysql# sql脚本的位置#data-locations:#- classpath:data-all.sql# 创建表sql脚本的位置schema-locations:- classpath:schema-all.sqldatasource:url: jdbc:mysql://192.168.31.12:3306/test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=falseusername: rootpassword: 123123# old: com.mysql.jdbc.Driverdriver-class-name: com.mysql.cj.jdbc.Drivertype: com.alibaba.druid.pool.DruidDataSource# ============================== druid ============================== #druid:#最大活跃数max-active: 20#初始化数量initial-size: 1#最大连接等待超时时间max-wait: 60000min-idle: 1#打开PSCache,并且指定每个连接PSCache的大小poolPreparedStatements: truemax-pool-prepared-statement-per-connection-size: 20# max-open-prepared-statements: 和上面的等价# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒time-between-eviction-runs-millis: 60000min-evictable-idle-time-millis: 300000# max-evictable-idle-time-millis# select ‘x‘validation-query: select 1 from dual# validation-query-timeout:test-while-idle: truetest-on-borrow: falsetest-on-return: false# 配置监控统计拦截的filters,去掉后监控界面sql将无法统计,‘wall‘用于防火墙filters: stat, wall, log4j3、schema-all.sql# 初始化创建数据库表CREATE TABLE IF NOT EXISTS `my_user122` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) COLLATE utf8mb4_bin NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;4、pom.xml4.0.0org.springframework.bootspring-boot-starter-parent2.7.12UTF-8UTF-81.8druid-jdbc-mysql-encrypt-datasourceorg.find${project-name}0.0.1-SNAPSHOTjar${project-name}${project-name}org.springframework.bootspring-boot-starter-jdbccom.alibabadruid-spring-boot-starter1.2.16log4jlog4j1.2.17com.alibabadruid-spring-boot-starter1.2.16mysqlmysql-connector-java8.0.32org.springframework.bootspring-boot-starter-weborg.apache.httpcomponentshttpclient4.5.14org.jsonjson20180130com.alibabafastjson2.0.32javax.injectjavax.inject1org.springframework.bootspring-boot-starter-validationorg.apache.maven.pluginsmaven-resources-pluginUTF-8org.apache.maven.pluginsmaven-source-pluginattach-sourcesjarmaven-compiler-plugin1.81.8org.apache.maven.pluginsmaven-jar-plugintruelib/org.fiend.MySpringbootAppfalseorg.apache.maven.pluginsmaven-dependency-plugincopy-dependenciespackagecopy-dependencies${project.build.directory}/libfalsefalsetrue
sql语句:增删改查,其中 增、删、改只用于单表多表级联删除,级联更新有时候会出现(例如:删除父类别,子类别也会被删除)多表查询:多表联查、子查询建表语句: 一般不需要语句建表,语句了解认识即可,手动...
2024.11.22面试官问题:说一说MySQL的日志文件内容?说一说你对MySQL重做日志的了解?MySQL重做日志时用来干什么的?背景:MySQL中有六种日志文件分别是:重做日志(redo log)、回滚日志(und...
2024.11.21mysql的慢查询sql是通过日志记录慢SQL--(俗称慢查询日志)默认的情况下,MySQL数据库不开启慢查询日志(slow query log),需要手动把它打开开启慢查询日志SET GLOBAL ...
2024.11.19转载请注明,原文地址:http://www.lgygg.wang/lgyblog/2020/02/17/mysql%e9%97%ae%e9%a2%98%e9%9b%86window%e7%b3%bb%...
2024.11.21有时候,我们要在命令行登录mysql,然后用source命令执行某sql文件,这样执行时,日志闪得飞快,还没来得及看,一下子就过了。这样不利于我们查看执行过程中的日志,我们不清楚是否存在执行错误的情况...
2024.11.21