Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
-4 votes
0 answers
23 views

Prevent duplicate entry in MySQL database when simultaneous data entry from Student and admin [closed]

I am using PHP and MySQL database. In a scenario were admin and student both hits database at a same time(milliseconds) and my database table gets duplicate record. Example: I have a table name ...
Newuser_901's user avatar
-4 votes
0 answers
28 views

MySql update if exists else insert (Not a procedure, Not a key) [duplicate]

This question has been asked numerous times. All of the answers in the other questions provide solutions which require a unique key. I am looking for code, which does NOT need a unique key. How to ...
Cymro's user avatar
  • 1,278
-2 votes
1 answer
59 views

Switch the departments of the two employees using a single query [closed]

The table name is Employee, here is the table below, I need to switch the departments so that John is purchasing and Jenn is accounting, but in a single query EmpID EmpName Department 1 John ...
THE BOB's user avatar
-1 votes
0 answers
11 views

Changing mysql binlog_expire_logs_seconds and restarting the service will reset the value to the default [duplicate]

I am using windows server 2019 standard and using mysql 8.0.33 version. show global variables like 'binlog_expire_logs_seconds'; When I check the value with above command, the default value of ...
nunun's user avatar
  • 23
-3 votes
0 answers
25 views

DB for storing simple but very long tables [closed]

I have a very simple database for storing values. CREATE TABLE arch (name VARCHAR (50), time DATETIME, value DOUBLE, state INTEGER, PRIMARY KEY (name, time)) I think about using MariaDB. I have about ...
chris01's user avatar
  • 12.3k
-5 votes
0 answers
29 views

How can I learn the argument and result types of MySQL built-in functions? [closed]

I currently work on checking the compatibility of our database with MySQL, but I am struggling to find the argument types and return types for MySQL, similar to the output of \df in PostgreSQL. I ...
nanlour's user avatar
-3 votes
0 answers
41 views

why we need c.CustomerName in groupBy? Is it really needed? [duplicate]

Question Find the total order amount for each customer. Tables: Customers CustomerID(PK) CustomerName City Orders OrderID(PK) CustomerID(FK) OrderDate OrderAmount answer: SELECT c.CustomerID, c....
You's user avatar
  • 1
-1 votes
0 answers
19 views

Can't connect to local MySQL server through socket '/var/lib/mysql/ [duplicate]

hello i can't conect mysql server cpanel root@server mysql]# mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) [root@server mysql]# ...
-3 votes
0 answers
27 views

How to display images from galeri_images table related to galeri table by gallery_id column? [closed]

I have two tables in my database: galeri and galeri_images. The galeri table contains details like id, title, and description, while the galeri_images table contains image URLs and a gallery_id column ...
desper's user avatar
  • 1
0 votes
0 answers
25 views

MySQL UNIQUE still allows duplicate row insert when foreign key columns are NULL [duplicate]

I Have 3 tables ProdVariant, Variant, VariantValues. ProductVariant ---------------------------- ProductVariantID PK ProductID FK NOT NULL VariantID FK NULL ...
Miff's user avatar
  • 15
1 vote
3 answers
64 views

Select instances of an entity which are in relation with all other instances of another entity

I have these 3 tables: CREATE TABLE Fair( Title varchar(100), Year int, PRIMARY KEY(Titolo, Anno), ); CREATE TABLE Animal( ID int PRIMARY KEY, Species varchar(100), Name ...
Rbn's user avatar
  • 11
-4 votes
0 answers
46 views

Embeddable JavaScript SQL console with autocomplete [closed]

My company has a web app that includes a SQL console for MySQL. It is very primitive, and with our database having hundreds of tables, it is missing one of the most helpful features: autocomplete. Is ...
DDx's user avatar
  • 1
0 votes
0 answers
57 views

How can I display stats from last 7 days, last month, etc.? [closed]

I need to display player statistics for last day, last week, last month, and overall. The statistics are stored in a PlayerShip model. I have tables that show stats for every individual player, the ...
djaka02's user avatar
  • 11
-1 votes
0 answers
10 views

digitalocean droplet custom metrics

I have a problem with a wordpress base image droplet, it's mysql server crashes once a while. It might be an OOM issue, but 99% of the time it works fine and restarts itself after crashes. I'd still ...
tonsteri's user avatar
  • 705
0 votes
0 answers
45 views

Optimize MySQL select query without any filter

I am working on a product where MySQL server has been upgraded to 8.0.32 from the 5.7 version. Now, I am trying to optimize a few MySQL queries, especially SELECT queries having no clause to filter ...
Dams's user avatar
  • 47
-3 votes
0 answers
43 views

How To Send MYSQL Data To An Email [closed]

After someone fills the form, the form data is sent to mysql and an email gets sent to me with the last form data that the sender submitted. But, the email "last mysql data" is not going as ...
user29090277's user avatar
0 votes
0 answers
29 views

Remove div html which contains link from the description column of a table using MYSql query

I have a database table like below: product_id product_description column product_description contain HTML like below: <div><span style="font-family: Arial, Helvetica, sans-serif;&...
Death-is-the-real-truth's user avatar
1 vote
2 answers
57 views

MAX in subquery causes index scan

I'm having a hard time understanding the behavior of my queries. Given following tables: CREATE TABLE messages ( id BINARY(16) NOT NULL PRIMARY KEY, chat_id VARCHAR(128) NOT NULL, ...
MM.'s user avatar
  • 57
-3 votes
0 answers
21 views

The SQL query above sorts by login_time, but the result is incorrect. The login_time type is DATETIME [closed]

The SQL query above sorts by login_time, but the result is incorrect. The login_time type is DATETIME SELECT JSON_ARRAYAGG( JSON_OBJECT( 'id', loginLog.id, ...
葛名露's user avatar
-1 votes
0 answers
45 views

Using CAST function in FROM clause with AS

assume I have a table called Table1 and it has a column A where A contains a lot of structs like this: { fieldA someOtherStruct fieldB int } Assume I NEED to use CAST here, and I want to ...
SOS's user avatar
  • 517
0 votes
0 answers
50 views

Making sure the SQL engine will prune away query parts that can be trivially rejected/never evaluated [duplicate]

In PHP, using MariaDB (and sometimes MySQL), I often need to insert query parts conditionally based on, eg., a condition expression in PHP: $somecondition = "1"; $statement = $pdo-&...
andynewman's user avatar
2 votes
2 answers
53 views

How can I perform a case-insensitive search of array members in a JSON column?

I have a situation where we are storing tags in a JSON array, and the client started using this as a key-value store. I now need to add a way to search this data case-insensitively. As an example, if ...
hackel's user avatar
  • 1,282
0 votes
3 answers
53 views

Can you help me speed up the selection when searching by square with latitude and longitude?

There is a request like this: SELECT * FROM `pet` WHERE (`unite_id` IS NULL) AND ((`status`=1) OR ((`status`=4) AND (`delete_reason` IN (1, 2, 5)))) AND ((`pet`.`latitude` BETWEEN '55....
pet karp's user avatar
-1 votes
0 answers
28 views

How to Optimize a Slow Symfony Project and Use Symfony Profiler Effectively? [closed]

I am working on a Symfony project that is currently performing very slowly. I want to optimize it, but I'm not sure where to start. Here are some of the performance metrics I've gathered using Symfony ...
Nizar Dridi's user avatar
1 vote
2 answers
52 views

Java application slow when connecting to MySQL server when not on LocalHost

TLDR at the bottom I'm fairly new to java and have been studying for around 2 years in my spare time. I've recently decided to try my hand at making some retail software for my small business. I am ...
spectation's user avatar
-1 votes
0 answers
21 views

Error - Error Code: 2013 Lost connection to MySQL server at 'reading initial communication packet', system error: 0

This error has a number of responses. However, the situation that I have is different from any of those already reported. I am using MySqlWorkBench on Win11. I only get this error if I leave my ...
Cliff C's user avatar
  • 141
0 votes
1 answer
25 views

Stored Procedure for Deleting in Chunks - LOOP not executing

Problem: The loop is not executed after the first loop. CREATE PROCEDURE IF NOT EXISTS chunk_delete(IN table_name varchar(255), IN loop_count int, IN batch_size int) BEGIN DECLARE counter INT ...
yooooo's user avatar
  • 3
0 votes
1 answer
39 views

Mysql multi-column indexes approach when table used twice in one query

I have mysql query that looks kinda like this SELECT * FROM table1 WHERE table1.column_1 = 'a' AND table1.column_2 = 'b' AND :idList IN (SELECT id FROM table1 WHERE table1.column_3 = 'c' AND table1....
LokiTheCreator's user avatar
0 votes
0 answers
30 views

Decimal values for DATE_ADD() in MySQL? [closed]

If I have something like DATE_ADD(scheduled_for, INTERVAL duration HOUR) and "duration" is .75 (45 mins.), will DATE_ADD() still work? The data I have to work with is stored as hrs. in the ...
user1518164's user avatar
0 votes
0 answers
26 views

Adding photos to database with Angular and mysql [closed]

Hi I’m looking for a way to add photos captured using a mobile phone to mysql database. The Angular on change event it adds the photos to the database but the name is NULL and it saves them to the ...
shadi abu saleh's user avatar
1 vote
2 answers
82 views

Return Distinct Concat Count if More Than One Result

I'm trying to get a distinct count of multiple columns grouped by another column, but I want the results to only include counts greater than ONE. So if I have the following: SELECT * FROM cast ORDER ...
Michael Kaiser's user avatar
-2 votes
1 answer
35 views

Date (and string) ordering reverse [closed]

My MySQL server seems to be ordering dates (and strings) opposite of what I would expect. Shouldn't earlier dates be less than later dates? I'm getting the reverse. What's up with that? There's ...
Phil's user avatar
  • 105
1 vote
0 answers
53 views

Performant Update of multiple columns using random values from another table

I need to update multiple columns of a table t1 with random rows from another table t2. t1 has ~ 1 Million Rows, t2 has 50k I had originally tried to use this Update t1 SET field1=(select t2.field1 ...
scalaLala's user avatar
  • 315
0 votes
0 answers
12 views

Unable to export table MySQL "Error Code:1290 The MySQL Server is running with the --secure-file-priv option so it can not execute this statement" [duplicate]

I am learning MySQL and installed it in my MAC. I am trying to export the table as csv using the into command but getting the following error statement "Error Code:1290 The MySQL Server is ...
Berlin G's user avatar
0 votes
0 answers
36 views

Serialization deadlock on upsert in Laravel with concurrent console commands

I need some help improving the performance of my Laravel 11 upsert query. I'm pulling thousands of entries in chunks from a Redis 7 stream and upserting into my MySQL 8 database. It's an aggregated ...
Ryan H's user avatar
  • 2,941
-1 votes
0 answers
22 views

SQL commands out of sync when using procedures [duplicate]

I'm working on some PHP: $sql = "SELECT * FROM `user` WHERE `UserID` = " . $pupID; $result = $conn->query($sql); if ($result->num_rows == 1) { $row = $result->...
Hayden O'Sullivan's user avatar
0 votes
0 answers
23 views

How to establish PDO encrypted (SSL) connection in PHP to mysql > 8.0.10 [duplicate]

I am having trouble successfully connecting to a Mysql 8.0.35 database with encryption required from PHP/PDO. We are testing setting the MySQL options to require secure connections and I am working ...
Sean Kidder's user avatar
-1 votes
0 answers
21 views

MySql - Error 1690 when select diff expression, cast not solve the problem [duplicate]

I get Error 1690 even it looks like not related. Here is my table columns declaration: CREATE TABLE `my_table` ( `ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `NAME` VARCHAR(30) DEFAULT NULL, `...
user5260143's user avatar
  • 1,096
0 votes
1 answer
56 views

Am I able to use this subquery to solve this SQL problem without having to use GROUP BY?

Am I able to use this subquery to solve this SQL problem without having to use GROUP BY? For each continent show the continent and number of countries with populations of at least 10 million. world(...
obito uchia's user avatar
1 vote
0 answers
35 views

Dead Lock found When multiple-column LOCK_DATA when runing select * from performance_schema.data_locks

I don't know why here have multiple-column LOCK_DATA when running select * from performance_schema.data_locks. It's like 'a', NULL,1 . a is the value of column_1 in table test_table, indexed. 1 is the ...
scanf3's user avatar
  • 21
-2 votes
0 answers
39 views

When fetched, date is shows as one day behind. The DB has correct data stored

I have a Node.js and MySQL project. The user inputs the date from a dropdown and submits the form. In the backend, I see proper date but when I fetch it, its 1 day behind. I've read that it might be a ...
raven's user avatar
  • 1
0 votes
0 answers
47 views

Need MySQL shorthand to match param to column specsm

I'm building the DB foundation (MySQL) of a new programming project and I'm starting to build the CRUD procedures for the core tables. To save time in the future, in case the size of a column changes, ...
Felix Cartwright's user avatar
-1 votes
0 answers
50 views

"Laravel" - Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' [duplicate]

I'm encountering this issue: "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' (SQL: insert into roles (name, business_ids, guard_name, updated_at, ...
Dũng Nguyễn Tấn's user avatar
3 votes
4 answers
92 views

MYSQL get first non null frequency with order by length ASC

Sample Records I need to get the first record which has a not null frequency order by length ASC. In case there is no not null frequency record, then fetch the top length ASC record. Here is what I ...
Kevin's user avatar
  • 33
-3 votes
0 answers
37 views

.NET Framework project where I connect to mysql and add items to a table, but why can't I press more than one button?

In my project whenever I press any one of the two buttons I've programmed (Add button to add items and update button to see the table in DataGridView), visual studio 2022 gets a sudden increase in ...
EverythingMain 's user avatar
0 votes
0 answers
21 views

Cannot import database to AWS RDS mysql using Workbench [closed]

I have an AWS RDS MySql instance and I'm trying to import a database from a sql script using MySql Workbench but it gives me following error related to an insufficient permissions. Does RDS not allow ...
thinuwan's user avatar
  • 665
0 votes
1 answer
79 views

What is the quickest and most efficient way to combine two MYSQL queries into one JSON result [duplicate]

I know how to use basic SQL queries but need to know the best way to combine two queries. For example, I can output users within a certain distance and it automatically adds a distance field. Ideally ...
JulesUK's user avatar
  • 487
-3 votes
0 answers
28 views

Fatal error when inserting DateTime into database in PHP [duplicate]

Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in D:\xampp\htdocs\projekat_berbernica\zakazivanje <?php if(isset($_POST['bn1'])){ $...
jebojebic's user avatar
-1 votes
0 answers
33 views

Finding and replacing a word in a description when the length is different every time [duplicate]

I have a database with product descriptions which vary in length like this one: O-Ring 9,19 x 2,62 mm BS110 Viton&reg; 75 +/- 5 Shore A schwarz/black I want to replace Viton&reg; with Viton® ...
Arby's user avatar
  • 17
1 vote
3 answers
96 views

Rolling sum that resets at a flag

I'm trying to sum values in a table and then reset the sum at a boundary. So, given a table like this id value flag 1 23 1 2 10 1 3 15 0 4 18 0 5 11 0 6 1 1 7 14 1 8 16 1 I'd want the sum to ...
Kevin Jones's user avatar

1
2 3 4 5
13231