MySQL: find out what date a row was added to a table? - mysql

I added a new column to a table called price_request_date because I now need to track the date each one was made. I made it so new ones enter the current date when they insert a new row. I was just wondering if there was any way to fill in the previous rows with the dates they were entered? I don't know if MySQL keeps track of that sort of thing or not, but worth an ask. Thanks!

There is not. There is no way to automatically backdate a timestamp field with the original creation date if it weren't already set at creation time.
Frustrating - I know.

nope. it is good to always include LastChgID and LastChgDate on tables like this, do that next time from the get go...

Related

Get a day of a week filled automatically to a new column with a WEEKDAY function MySQL

I am stuck on a problem I have with MySQL, I am quite new to it so please have patience :D. I have a table that includes a column with specific dates (each date has multiple entries) and I would like to create a new column with a specific day (Monday, Tuesday, etc.) based on the date I already have. I found a function WEEKDAY I would like to use, but I can't find a way to update all the rows automatically.
I already ADD COLUMN "day" (which is empty now) and need to add the values for all rows. The table has a thousand rows so there is no way I would do it manually one by one. I am sure there is a way around doing it by SQL code. Would appreciate it if anyone can give me a hint.
Thanks a lot!

Fetching rows changed or added last day without time field?

I want query a table to find the changed rows last day. But there is no explicit time filed in column name. Is there any way I can access these data?
Without a field indicating when a record was changed there is no way to determine when a record was changed, therefore it is unfortunately impossible for you to query the records changed yesterday.

Inserting a 'day' column in Access

I'm working in Access and currently have a column with a time stamp in the format DD/MM/YYYY hh:mm. I'm trying to insert a column next to it that only contains the relevent day in number format without the rest of the timestamp. I'm sure this is painfully simple but for some reason I can't figure it out.
Many thanks,
Matt
In a query, add the expression:
Day([YourTimestampFieldName])
In a form with a textbox, use this ControlSource for the textbox:
=Day([YourTimestampFieldName])
If relevent day in number format means something else than the day, please specify.
You have multiple options.
You can design to column to be a specific format in the table design view. This will enforce date formats for you. Its been a minute for me, but I believe it even works as you try to insert into that column.
You can use the FORMAT function on inserts, as getting data from another column/data type is what youre doing. its actual specific use is of:
FORMAT(yourColumn, "MM-DD-YYYY")
If you need more specifics, you can google the function.
You can set up a macro that will function like a trigger in normal RDMS's. This i envision will UpSert the value to the new column based on INSERT/UPDATE logic.
Let me know if you think this requires more assistance. I think this should be more than enough to get you started.

Getting Rows Inserted After some date/time

I need to get all the entries that were added 'today', ie 24 hours prior to the point of execution. It is simple enough to do so with date column, which I don't have. Is it at all possible to find these rows without such column?
Thanks
No, you can't do it. If you don't have a date stamp on the row, then there's no way of knowing when it was inserted.

mysql get last modify date for data

I wanna get last date when i make change in tables something like update add remove so not last modify date that table structure have been changed!
is there any way to catch this?
There is a way. But involves either writing a trigger to insert information into a "log table", or adding a last_update_time column to your table and keeping it up to date always. There is no automatic way of doing it.