I have a query I made: The results table has 25000 entries and it takes around 7 seconds to do this query, which is far too long. The query is incredibly inefficient as each column I’m creating is searching again on the same table but with different conditions. I tried indexing the columns of interest i…
Explanation query with GROUP_BY and ONLY_FULL_GROUP_BY
I want to understand how queries works with ONLY_FULL_GROUP_BY enabled. If i list all the columns of the table with a MIN() on one column, it works fine: $query = “SELECT id, member_id, name, …
PostgreSQL Composite Foreign Key ‘columns list must not contain duplicates’
This is my example schema: CREATE TABLE users ( userid BIGSERIAL PRIMARY KEY, name varchar(25) NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE …
Display Count of DB Records in PHP Dashboard
I need to display a “count” of records (rows) in my SQLtable “doctors”. This count must appear on my dashboard page in the below element for total number of doctors This is index….
I would like to order in SQL server where the first line is the same, but later it’s different
The point in this case is that the starting point is the same for a line, let’s say a train line. The line starts on the same point, but ends on different end points. The services depends on the line …
The function processes the sql request
The function processes the sql request. It receives parameters and one of them can be either “null” or a value (uuid), I need to add this value to where. But there is a problem, because with null “where param is null”, but with the value “where param = value” Example Answer…
Redshift If TableA contains data then TRUNCATE TableB and INSERT TableA into TableB ELSE do nothing
I am trying to create a query in Redshift but I am struggling to ether create the correct logic or to get it to run full stop. I have 2 tables TableA and TableB. If TableA contains data, then wipe TableB and insert the data from TableA. Pseudo: Obviously this wont work so do I need to do something with
Website language translation in PHP (SQL)
i want to implement in my website a language translation. For this is created a table “translations” in my database: id | de | en | other languages 1 | Hallo | Hello | … Based …
Create a table for each user with their ID
I have a problem with a website that I am currently creating that I need a table for each user but it does not work. I have tried to create a table during registration or the first login, which also works. My problem is with the naming of the table, because I want the table to have the following name.
PostgreSQL: show trips within a bounding box
I have a trips table containing user’s trip information, like so: select * from trips limit 10; trip_id | daily_user_id | session_ids | seconds_start | lat_start | lon_start | seconds_end | …