I have a table which gets populated daily with database size. I need to modify the query where I can calculate daily growth and weekly growth. Current Output I would like to add two additional columns which would be Daily Growth (DB_SIZE sysdate – DB_SIZE (sysdate -1)) Weekly Growth (DB_SIZE sysdate …
Selecting values from different columns in rows with the same ID
I have a table called COURSE_SELECT that shows students and which online products they will be able to access, but each product is in a different row, even when each of them has their own column. Table: COURSE_SELECT The vendor needs me to send a CSV file with only one row per student, like this: I have no id…
Compare values of timestamps and assign a value to each of them in case they have changed
DB-Fiddle Expected Result: In the above result I want to list all products from the table and compare the two time_stamps to each other. If the plan_week of one product has switched between the both time_stamps I want that in the additional column called week_switch the word yes gets inserted and if not the w…
Msg 100, Level 16, State 0, Line 109 insert statement error
While inserting the values in this table error occurred.and after adding constraints it’s not working on that condition too. What to do?? Answer When you have defined relationship then data should be present in Parent table first before inserting the data in child table otherwise data in child table is …
How to convert int year to date and display it as century SQL Oracle?
how can I convert int like ‘1984’ to date and display it as century SQL Oracle? Answer If the column is a date/time or timestamp:
SQL table primary key’s index is starting at 3
I set the column Id to the primary key and set it to increment but its starting at 3 for some reason. I will post a picture below: Sql table not incrementing correctly
How to use strftime() function in sqlite for extracting Year where datetime is in a different format than what would normally work
While learning SQL in my course, I have used the function YEAR(Start_Time) AS Year Start_Time is a column header. The date time example is in this format: 26/12/2017 09:00:00 YEAR() function works in …
Microsoft Access “User-defined type not defined”
When trying to run the following code, I’m getting an error when it hits Dim qdf As QueryDef saying User-defined type not defined I think it’s really weird because I have a backup of this same project in which not many changes were made after it which is working completely fine for this. I’v…
REGEX Extract Amount Without Currency
SELECT ocr_text, bucket, REGEXP_EXTRACT(‘-?[0-9]+(.[0-9]+)?’, ocr_text) FROM temp I am trying to extract amounts from a string that will not have currency present. Any number that does …
Postgresql: more than one row returned by a subquery used as an expression?
I have a query to find the youngest generation in a family tree. This is my database ID NAME PARENT_ID 1 A 0 2 B 1 3 C 1 4 D 2 5 E 3 6 F 3 7 G …