673,572 questions
Score of -4
2 answers
196 views
Can I perform a (LEFT) JOIN with a potentially not-existing table?
I need to join a table, that might not exist. Is it possible to specify a condition in the query, so that the join is only performed if the table actually exists? My idea would be that the ...
Score of -4
2 answers
151 views
Query doesn't recognize a table name [duplicate]
I am trying to join two tables in BigQuery. However, my code is generating an error that one of the table names is not recognized and I don't know why. Can you explain why this is happening, and fix ...
Score of -3
0 answers
76 views
Add total value to sum items [duplicate]
I'm trying to modify an existing report using Oracle SQL to add a "total" to the values in column NET_AMOUNT based on the location.
The current output looks like:
ref_no
year
location
make
...
Score of 0
0 answers
88 views
USE_COLUMN_TABLE hint has no effect in EXPLAIN — same plan with and without hint
I'm on OceanBase CE 4.3.4 (5.7.25-OceanBase_CE-v4.3.4.0), MySQL mode, single-node. Same session:
DROP TABLE IF EXISTS tt_column_row;
CREATE TABLE tt_column_row (
c1 int PRIMARY KEY,
c2 int,
c3 ...
Score of 3
2 answers
138 views
Use a group by to have as results a count of 'value = x' and a count of 'value <> x'?
I'm writing a query in Oracle SQL. I'm using a count - group by query, for example:
select column_a, count(*)
from table_1
group by column_a
COLUMN_A COUNT(*)
value_1 5
value_2 6
value_3 ...
Score of 0
2 answers
124 views
Modeling bounded polymorphic children in SQLite/Drizzle: JSON column vs. Concrete Table Inheritance [duplicate]
SQLite/Drizzle: JSON column vs. normalized child tables for question data?
I’m using SQLite with Drizzle ORM. My questions table is currently normalized, with separate child tables for each question ...
Score of 2
1 answer
213 views
How can I exclude holidays using my custom holiday table in my SQL code that excludes weekends
I have completed my SQL code to exclude weekends, but how can I incorporate my dbo.Holidays table into my code to exclude those dates from being added to the 3 days?
In below example, for ContactID = ...
Score of 0
1 answer
77 views
Configuring foreign key using Fluent API does not work
The screenshot shown below shows the tables along with the existing relations between them, as well as the new connections or relations that I want to create: I want to add two one-to-many ...
Score of 7
4 answers
326 views
How can I find a specific consecutive sequence of rows in SQL without MATCH_RECOGNIZE?
I am working with a time series dataset of crime events. I need to find a specific sequence of consecutive events (ordered by time) based on their crime type.
My table schema is: CRIMES (TS LONG, TYPE ...
Score of 0
1 answer
104 views
What’s safer when deleting all records for one company from a shared table: filtering by company ID or using the full composite primary key?
I have a table that stores records for multiple companies.
The table uses a composite primary key:
PRIMARY KEY (ruc, codigo)
Where:
ruc identifies the company
codigo identifies a specific record ...
Score of -5
0 answers
103 views
Update column in table 1 with data from table 2 [duplicate]
I have two tables as shown below.
Table sb_bans has authid which I can use to match with authid in table sb_named.
Table sb_named has name which I want to take the value from here and put it in the ...
Score of 1
2 answers
102 views
PlanCache overhead with plan-time partition pruning in PolarDB-PG
I have a repeatable planning-time performance issue caused by the
interaction between PlanCache and plan-time partition pruning for prepared
statements on partitioned tables in PolarDB-PG.
My server ...
Score of 0
0 answers
141 views
How to left join tableB to tableA and save changes to table B
I have an SQL query that left joins tableB to tableA as shown below:
CN.Open()
'The view vTimeTest relates the Time to JobMaster and Employees grouped by JobMaster.Name, Time.QB, Employees.ID and Time....
Score of 1
2 answers
170 views
Query filters are duplicating SQL
I need to filter rows for security in my SQL queries. Query filters look the best options for this.
Let's say I have the following model classes:
public class Brand
{
public int Id { get; set; }
...
Score of 0
0 answers
117 views
Why are the ASCII codes of characters not seen in the dump function output for an object type of varchar2(3885) in a select statement SQL?
I have defined two object types as follows
create or replace type co.mytype_1__ as object (c1 varchar2 (3885))
/
create or replace type co.mytype1_ as object (c1 varchar2 (3884))
/
And run following ...