I need to do some clean-up in a database and change some urls from http://www.domain1.com to http://www.domain2.com, so I am doing a query like this: UPDATE mytable set url = REPLACE(url, ‘”http:/…
Fastest way to determine if a single row exists in a another joined table, equivalent of the ANY linq function [closed]
I am trying to return a bit field for a join onto another table but where if a single record exists it returns ‘1’ and if none exist it returned ‘0’. I can’t afford to slow down the operation so it …
I have date function to create for entering date and to create random time i want to combine both of them
hi dear i have a query which create dates for specic lenght which is mentioned and a query which is create random time want to join both for date generating is this It create dates for specific lenght …
Join SQL without Unique Identifier
I have two tables: Table A: EmployeeID DailyHour Date ID001 2 2021-02-01 ID001 4 2021-02-03 ID001 4 2021-02-04 ID001 4 2021-02-10 ID001 8 2021-02-15 ID002 8 2021-02-20 Table B: EmployeeID …
A query for getting results separated by a date gap
ID TIMESTAMP 1 2020-01-01 12:00:00 2 2020-02-01 12:00:00 3 2020-05-01 12:00:00 4 2020-06-01 12:00:00 5 2020-07-01 12:00:00 I am looking for a way to get records in a MySQL database that are …
How can I get the percentage of the sum of the top 5 countries in SQL?
I want to calculate the percentage of the sum of the top 5 countries by number of customers compared to the total number of customers. The SQL Editor rounds decimals, therefore the counter of my …
PostgreSQL add new not null column and fill with ids from insert statement
I´ve got 2 tables. The tables are already filled with a lot of data. Now I want to add a new column content_id (NOT NULL) to the data table. It should be a foreign key to the content table. Is it possible to automatically create an entry in the content table to set a content_id in the data table. For
Calculate average days between two dates
I have the following table: Team PhoneNumber OrderNo CallDate OrderDate TM1 2222222222 26699443 2021-01-28 2021-02-05 TM1 1111111111 26699450 2021-01-22 2021-01-22 TM2 5555555555 26699466 2021-02-…
Daily active counts of THING from rows detailing change of THING
Say I have a table of people who have used my service on a day N and a table describing what theme the users have changed to. There’s no table available telling me what theme they are currently using. …
Join table with mapping of array in postgres
I want to join two table, with first table contain an array which is primary keys of second table in JSON format Answer demo:db<>fiddle You can use the ANY function: Edit: demo:db<>fiddle If you have jsonb arrays, you can use the @> operator. Note, that this works only if your integer id values…