All Questions
11,755 questions
1
vote
0
answers
18
views
What is an elegant way to select a database cell and then increment it? [duplicate]
I have a stored reference number, let's call the variable "my_index," in a table of variables.
id
var_name
var_value
1
black
#000005
2
domain
example.com
3
my_index
3
I need to collect that ...
-1
votes
1
answer
53
views
mysql select and set variable in one query
I have 2 tables:
comments_table
id int(11) unsigned NOT NULL AUTO_INCREMENT,
media_id int(11) unsigned DEFAULT NULL,
user_id int(11) unsigned DEFAULT NULL,//user who commented
title varchar(300) ...
-1
votes
1
answer
52
views
MySQL Sorting 1 column by word length then alphabetically [duplicate]
I am working on a site that displays all possible words from letters entered. There are words in the database up to 15 in length. Approximately 170,000 words. When I enter up to 8 letters, everything ...
1
vote
3
answers
92
views
MySQL select collections matching multiple subgenres
Assuming these two (simplified) tables:
CREATE TABLE books (
book_id VARCHAR(25) NOT NULL,
subgenre_1 VARCHAR(6) NOT NULL,
subgenre_2 VARCHAR(6),
subgenre_3 VARCHAR(6),
mood_1 ...
0
votes
0
answers
38
views
Mysql, select combined [duplicate]
I have a first query like this:
SELECT category, name FROM table_1;
There is one result:
category name
-------------------------------
gardener example
I need to make ...
0
votes
2
answers
60
views
Can't manage to make multiple averages with SQL [duplicate]
I've been trying to see the average salary of each profession of a hospital (this is an exercise BTW) but I can't manage to make an average for each service separately.
My last and what I believe is ...
-1
votes
1
answer
71
views
MySQL query to avoid displaying duplicate records having same user_id, user_email, user_ip
I am not sure how to achieve this by a MySQL query:
I have a list of ads posted by multiple users and some users post multiple ads (e.g 10-20), when I load a list of ads (e.g sorted by ad_date DESC) I ...
0
votes
1
answer
55
views
MySQL Simple select query with static value [duplicate]
Sad that a simple select query is taking away my breath. I am creating an alerting tool which can alert when the DB credential expires. The tool can do this on both MSSQL and MySQL. In MySQL I am ...
1
vote
1
answer
88
views
MySQL pagination query is very slow [duplicate]
I have this table using InnoDB as engine:
create table if not exists Playlists(
UserId bigint unsigned not null,
Title varchar(50) not null,
IsPublic bool not null,
primary key (UserId,...
0
votes
2
answers
70
views
MYSQL - How to find registers with same data in a field, but different data in another field? [duplicate]
I'm trying to identify in my database which users are using other users' "IDs".
MY DB:
ID | NAME | CARDNUMBER | SHOPNUMBER
1 JO 1234 73839
2 ANDY 9876 79487
3 ...
1
vote
1
answer
80
views
Is there some way to get the effect of LOW_PRIORITY for select in MySQL?
I read mysql document and find for insert there is a LOW_PRIORITY switch while for select there is a HIGH_PRIORITY.
I need a "LOW_PRIORITY" (so to speak) for some of my slow query. For ...
0
votes
3
answers
78
views
Mysql Query batched result grouped
I wish to achieve something like this from a MYSQL SELECT query
I wish to group the results from the select in 500 rows (per batch) and have a column called group (or anything) for the key to the ...
0
votes
1
answer
72
views
Select random elements excluding given range and not starting with same word
I have a "foods" table containing foods:
id
name
1
pasta with meat
2
pasta with cheese
3
ice cream
4
salad chicken
5
noodles
6
salad tuna
and a "weeks" table containing the last ...
0
votes
1
answer
46
views
Filter by a value in JSON for any key
Is there a way in MySQL to use JSON_SEARCH() or INSTR() to filter rows by the whole word inside of any available JSON values without knowing their keys?
Test data - but keys can be other locales, not ...
-4
votes
1
answer
46
views
fetching the currenct financilal year data matching with previous year data by email,pan and mobile [closed]
I have more than 1,000,000 data rows in one table (example table name is :test1) and running below query and its taking more than 10 seconds to load the data so can you any one plz guide us to improve ...