skip to Main Content

Mysql – How to drop foreign key using a subselect?

First off, we're using MySQL 5. I'd like to do something like the following: SET @fkcn = (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND REFERENCED_TABLE_NAME = "ProviderOrder"); ALTER TABLE AuditProviderOrder DROP FOREIGN KEY @fkcn, DROP COLUMN ProviderOrderID;…

VIEW QUESTION

Query in Laravel, get multiple data with GroupBy

I have a table with these columns: event_time (date) event_data (json) player_account char() I'm trying to get all three fields from my query and groupBy by "player_account" field. The problem is doing this query: DB::connection('aa')-table('bb') ->where('event_time', ">", $date) ->select('event_time', 'event_data',…

VIEW QUESTION

Mysql – i am learning springboot and try to create a table user (maven project)

i am using vs code , jdk version(19), windows 10, java 17 for springboot ,mysql ,hibernate ,lombok etc . the project files are as follows; pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.0</version> <relativePath/>…

VIEW QUESTION

Mysql – how to add a temporary coloum for sql query

i have a sql query for summary my table, $this->where('kriteria =', 'fakir'); $this->where('zona !=', '0'); $this->select('surveyor,zona,kriteria,area'); $this->selectCount('surveyor', 'count'); $this->selectSum('nilai', 'nilai'); $this->groupBy('surveyor'); $this->groupBy('kriteria'); $this->groupBy('area'); $this->orderBy('kriteria', 'ASC'); $this->orderBy('zona', 'ASC'); $this->orderBy('count', 'DESC'); surveyor zona kriteria area COUNT RT06 RW07 1 FAKIR RUNGKUT 125…

VIEW QUESTION
Back To Top
Search