Questions tagged [sql]
Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.
672,933
questions
1
vote
0
answers
11
views
Find records as And in MYSQL
I want find Students id that , must have (professorId = 3 And courseId = 4) And (professorId = 3 And courseId = 2) And (professorId = 5 And courseId = 8).
sometime these parenthesis is one or more ...
0
votes
0
answers
25
views
SQL Inner join with where clause works fast with one condition, but not when activeFlag is added
I have a query like
select C.customerId, C.firstName, C.LastName, R.IsActive from
Customer as C
Inner join Rider as R ON R.customerId = C.customerid
where R.rideid = 'xyz' and
R.rideareacode = 'abc' ...
-3
votes
0
answers
21
views
Asking for help converting SQL query to EF Core [closed]
I have a working program that uses SQL queries to collect data. I'm working on converting it to EF Core 8.
I found an online convert but the result will not compile in my C# project. Can someone ...
0
votes
0
answers
25
views
Joining tables with different date formats (Literal does not match format string)
I'm trying to join two Oracle tables (basically to pull in a daily rate against the date in another table), but the table I'm pulling the date from has the timestamp in it. I'm seeing a lot of ...
0
votes
1
answer
21
views
Accessing deeply nested fields using DuckDB SQL
I have some deeply nested data from a json file and I'm trying to load it into DuckDB:
"events": [
{
"id": "401638586",
"uid": "s:40~l:41~...
0
votes
0
answers
46
views
Need to Get the no.of records Inserted in Sql Table in last 10 days
In my table I didn't have primary key and forgot to add timestamp column. Now I would need to find the records with date time of insertion in last 10 days. Is there a way to find this? If yes then how?...
0
votes
1
answer
27
views
How to query for an amount when it changes values base on a record (account#)
I am trying to query for an amount when it changes base on a record. For example the below table.
I want to query for the rows with a (****). I want to know whenever the balance changes for each acct. ...
0
votes
1
answer
15
views
How to add permission to custom role in postgres to create index
I am currently creating a role for a particular database using the below sql script executed as master user (postgres).
CREATE USER customrole WITH PASSWORD 'mypassword';
-- removed CREATE ...
0
votes
1
answer
15
views
How can I rank after filtering inside a window function?
I have a huge BigQuery table "taskperformance" that attributes tasks to sales (ordered in this example for easier
understanding):
sale_id
sale_timestamp
task_id
task_timestamp
is_same_store
...
-2
votes
0
answers
49
views
Why am I getting the wrong value or NULL after doing left joins? [closed]
I have a table called Persons with an ID column. I have another table called Cases which has an ID, another PersonID, and the date that the case was made. I have a third table called PersonsCases, ...
0
votes
0
answers
12
views
Best practices for improved performance for data retrieval interaction , sql or graphql within flask
Let's say I have three products. one is my database, accessible through SQL , a GraphQL server, and a webApp GUI to access the information of interest.
As an example i will say that people around me ...
0
votes
0
answers
47
views
Improve performance or change query so it can be an indexed view
We have this query in a non-indexed view in SQL Server 2022.
It's used everywhere and I'm trying to improve the performance. A lot of queries we use elsewhere join to it.
My thought was whether there'...
-1
votes
0
answers
40
views
Stored procedure data export double quotes
I created a previous post about double quotes in a query which gave me a good answer but unfortunately I'd have not posted the full stored procedure. I'm having some trouble getting double quotes to ...
-4
votes
0
answers
32
views
Validating rules [closed]
I've a table data:ORG ER |ACT | BUD N |ACT N_1
I identify the cases where I need to identify the ORG ER which will be rejected and I need to insert it in a table of reject.
Here the rule 1 that ...
0
votes
2
answers
25
views
Query the lowest sub-value where the main value is grouped
I am trying to create a basis for a list of products in an MS Access Query. The basis must later be used in a form where the products are visualized with only one of the many images associated with ...