All Questions
6,346
questions
-4
votes
0
answers
22
views
Gent Rent availability in each hour for 2 weeks, depending on rent schedule, item quantity and current orders dates [closed]
I am trying to implement the function in PHP/Laravel (it is possible and advisable to use Carbon to work with dates) for this task, and don't know how to do this properly:
I have two arrays, one ...
1
vote
1
answer
33
views
MySQL: Date String to Date to Month coming back as Null
The dates in this database are in the form of a string, and in this format:
"1/5/2019"
I can use this query to convert the string dates to a date:
SELECT STR_TO_DATE(`date`, '%m/%d/%Y') ...
0
votes
0
answers
28
views
MySQL Date Column Index (NO Datetime)
I have a table with a date column (NO datetime, date only), which I always use to retrieve information by YEAR using BETWEEN. I was wondering if it's more efficient (and faster) to add a column to ...
0
votes
1
answer
46
views
MySQL Error Code: 1411. Incorrect datetime value: 'date' for function str_to_date
I'm attempting to change the date format from MM/DD/YYYY to YYYY-MM-DD.
Code:
SELECT `date`,
STR_TO_DATE(`date`, '%m/%d/%Y')
FROM example_table;
Results(success):
date ---> STR_TO_DATE(`date`,...
1
vote
1
answer
26
views
Add days to date without using adddate
Add a integer number of days to a date in MySQL without using adddate.
Obviously the following code does the job:
adddate('2024-01-01',100)
My failure attempt is:
'2024-01-01' + 100
Does anyone know ...
0
votes
1
answer
47
views
MySQL Query to fill a gap of data
I'm managing a DB which had some problems and I was asked to fill the gap where the database wasn't reading with previous data which was already there. So, the table sensors doesn't have data between ...
0
votes
1
answer
45
views
Changing data from DD/MM/YYYY to mySQL format YYYY-MM-DD [closed]
I am currently trying to get the data that I loaded from a .txt file to show the data in a way that I can manipulate it via excel's YEAR(function). The raw data date format looks like this:
01/03/2018
...
0
votes
0
answers
31
views
how to count days elpased between each interval using mySQL?
I have a table that has date range and i want to calculate the days that has been elapsed between 2 date
workorder
sequence
start date
end date
123
1
2024-01-02
2024-01-05
123
2
2024-02-01
2024-02-...
1
vote
1
answer
42
views
MySQL question. Struggling to convert text string in correct date format
I have a column named strdate in MySQL database with a table named data. The strdate column is of type varchar(100)
I tried a couple of ways to use the select command to get results in a legitimate ...
-1
votes
1
answer
43
views
mySQL: SUM electrical usage data by peak use, off peak use and total use GROUP BY site and day
I have a mySQL table with 5 or 15 minute interval electrical usage data. I would like to sum each site's yesterday usage and summarise 'off peak', 'peak' and Total use for each site.
Desired Output:
...
0
votes
1
answer
65
views
Check if date exists MySQL
Im validating an csv file that is being imported to the database via LOAD DATA LOCAL INFILE and im using a before insert trigger to achieve that (it is a dirty table, so when this process finishes i ...
-2
votes
1
answer
74
views
finding out the train station based on train arrival and departure in MySQL
I have to find out the train station in which the trains have arrived in the present day and have departed the next day, For example a train arrived at 11:55 PM but departed at 12:10 AM. I have to ...
-1
votes
2
answers
63
views
How would I find records in the future
If a slot is recurring it happens at the same time each week.
How would I fetch records scheduled later in the day, week, or month, considering the current date and time? I am using MySQL.
My current ...
0
votes
1
answer
127
views
Using DATE as part of a composite foreign key in MySQL
I have a table that, minimally, has
CREATE TABLE IF NOT EXISTS T (
A int(11) NOT NULL,
B date NOT NULL
);
A and B themselves happen to have FK constraints later on, but since this isn't part ...
0
votes
1
answer
46
views
How do i order by month when using the FORMAT function
I tried to do it but it keeps messing up the order for some reason. I tried DATE_FORMAT and it says it's not a recognized built-in function name
Select
FORMAT(ProcessDate, 'MMM-yy') as ProcessDate,
...