I want to create a date in the format YYYY-MM using postgresSQL. The month should always be two digits. For example if it is August 2020 the result should be 2020-08 and not 2020-8. Therefore, I …
1:N relationship to profile or user table?
Suppose I have a User Table and a UserProfile Table that I have separated. The two tables have a 1:1 relationship. User table contains only data like email and password, while UserProfile contains …
adding trimmed substrings
using sql server: I have a number of commands that trim a txt file, example: Case when charindex(‘-‘, Substring([RawStreamOut], 179, 10)) > 0 then ‘-‘ + Replace(LTrim(RTRIM(…
ERROR 1064 (42000) while creating a table and database in mysql
I am getting following error while executing my mysql query via a .sql script, but couldn’t tell what is causing this error. I am using mysql Ver 8.0.23 for macos10.15 on x86_64 (MySQL Community …
Split string without string_split (Sever 2012) [closed]
I would like to know if and if it’s possible how to split a string in to different columns. So first of all I have the table tabOld which contains: name 5522-rep__-4210-03-test-434907-emn-nt.pdf …
SQL, how to group rows based on field values
i have question about query result group. The image is a example. it is cable list. Each cable come with two attributes, ‘From’ location and ‘To’ location. if we’d like to group the cable list by …
How can I count the amount of items per user?
What I need to do is to Count the Times a User has received the treatment ‘Oxygen’. I’m trying to do like below but I’m getting all of the entries from Treatment_Victim per user. Any help is well …
How to get the most liked users on a particular date in django
So I have a social media app, where users can like the posts of other users. Now I fetch the top 20 users who have received the most number of likes. Everything is perfect. But the problem is I cant …
Group by Count of DateTime Per Hour by removing Duplicates?
I have a table named loginData: userName timestamp abc ‘2007-01-01 12:00:12 AM’ def ‘2021-01-01 12:09:12 AM’ abc ‘2021-01-01 12:40:12 AM’ abcde ‘2021-01-01 12:44:12 AM’ From this …
Create calculated field from MIN() and MAX() values of another column, grouped by unique ID
I have a table that looks like this, containing information about an object’s position and the length of time it existed for (age): Date ID Age x y 2021-03-25 20 1 531 295 2021-03-25 20 …