All Questions
309 questions
3
votes
1
answer
136
views
Faster Query to Track State changes in a Large Table
I have a table that tracks state changes of an entity with timestamps. The schema of the table is as follows:
entityid
userid
originalvalue
newvalue
changetime
255
101
Draft
Submitted
2023-11-28 12:10:...
2
votes
1
answer
250
views
MySQL interval search query suggestions
My database structure is:
...
3
votes
1
answer
99
views
SQL query creating tables needed by a simple PHP CMS
I have written recently the SQL query to MariaDB that I want to move into PHP code. Below is my test.sql file. What do you think about my SQL code?
...
3
votes
0
answers
93
views
Create table of yearly monthly temperatures from monthly data
I've got a series of tables with monthly data on USA regions over about 130 years, divided by either climate divisions (clim_div) or other federal standards (ncdc_fips). They all follow the same ...
-3
votes
1
answer
85
views
Preventing PHP SQL injection on login [closed]
I had a login code like this:
...
1
vote
1
answer
57
views
Find offers that can be matched with bids
I am working on a sql query for the following scenario:
Get all available offers for registered demand (offers from profiles
should not be from profile which had registered demand). After that
get ...
4
votes
3
answers
401
views
Queries to get products selected in multiple stores
Project description
I'm making a website listing products. The listing goes as following (See here):
Product name
Shop name
Price in that shop
If the product appears multiple times in the table for ...
0
votes
2
answers
193
views
Version 2: Display visitor's number on your web page (changed code after getting answer for first version)
Version 2: Display visitor's number on your web page (changed code after getting answer for first version).
The first version is here: Display visitor's number on your web page
The "visitors&...
0
votes
1
answer
290
views
Display visitor's number on your web page
Display visitor's number on your web page.
The "visitors" table has only one column (visitor_count) and only one row. The column's initial value is 0.
I know goto should not be used but then ...
2
votes
1
answer
654
views
SQL query to find expenditures of employees who have exceeded their limit
I've 2 tables emp and expenditure.
Emp:
ID, NAME
Expenditure:
ID, EMP_ID, AMOUNT
Each emp has a limit of 100 that he/she can ...
2
votes
1
answer
77
views
Calculate time interval excluding breaks
I have a solution for a question I asked on SO:
I am trying to create a database where I also need to find the time
difference inside a record. However, timediff() ...
1
vote
3
answers
190
views
SQL query joining applications to categories
I do have large database and my query takes about 2s to complete on production environment which is kinda slow and would like to ask is there a space for improvement?
My initial inputs are ...
5
votes
1
answer
3k
views
Student report card management Python program
The program is designed to take data from a MySQL database, using mysql-connector-python, and print it as a table in Python using the texttable module. The program also plots charts based on the data ...
8
votes
3
answers
951
views
Schema design for user profile and transaction
I'm creating a schema design for a user profile and transactions.
I am very new in data modeling and currently this is my design. The schema has multiple deposit ...
3
votes
4
answers
197
views
Order a table by column and get row number
In my database, I have table wp_postmeta, example:
...