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.
44
questions
-1
votes
1
answer
24
views
Why am I not getting a correct calculation result in SQL?
I have a script in SQL that in some of the fields I need to sum or perform a certain calculation on several fields
The problem is that instead of the sum it gives me several lines.
The code is:
select ...
1
vote
0
answers
25
views
Pivot query in SQL Server with nvarchar datatype
I have a table as below "table1"
Here value is of type "nvarchar(300)" but it contains both numeric string and string values.
ID
DocID
Name
Value
1
4
A
1234
1
4
B
false
2
4
A
...
-1
votes
0
answers
12
views
Accessing Synonyms using Langchain SQLDatabase Class
I have a SQL database schema that has only synonyms with no tables and views. I want to use Langchain SQLDatabase to access synonyms directly using my GPT APIKeys without having to write separate ...
0
votes
1
answer
26
views
ORA-02020: too many database links in use
I have been working on a oracle database query that uses more than 4 database links and I keep getting this error ORA-02020: too many database links in use.
I cannot change the limit and tried using ...
2
votes
1
answer
64
views
Join tables with condition that all row values are unique
I have tables Machine and Inventory. In table Machine I have last running inventory properties. In table Inventory, I have new inventory id and properties (Not yet run in machine).
I have to return a ...
-2
votes
0
answers
19
views
What is the unity of time that dbeaver uses in his analytics?
I'm using dbeaver connected to a PostgreSQL database to create a SQL query. And I'm trying to get the analytics of that execution.
But I can't understand which unity of time it get as response.
My ...
0
votes
1
answer
27
views
Storing text data from python web scrape
So I have scraped the information that I want but I don't know how to store it. So, I can manipulate it and clean it. It's one long string either I would like to store it in a csv file or a database ...
-2
votes
1
answer
34
views
Extract Combination of values from 1 table not in another table
2 tables with similar information. There are n number of Unique Teams and 2 unique Types and 2 Unique Products. So, for each Team there are 4 rows in Table 1.
Table 1
Team
Type
Product
Team1
New
TV
...
0
votes
0
answers
16
views
Bulk Table export as DDL separated files in DBeaver
I am trying to export and entire database's schemas for tables, views, etc.
I must export the schemas as SQL individual files.
I've been doing it manually through the option generate SQL-> DDL but ...
0
votes
2
answers
35
views
Filter multiple rows to a single row
I have a table DrData that stores doctor data. One doctor can have multiple rows on this table. One row for each location they provide services for within a healthcare system. On this table there is a ...
1
vote
2
answers
47
views
INSERT and UPDATE the Values into the table based on condition
I have 2 tables:
Table 1: EnrollmentTransaction (PK is both the column)
EnrollmentId | TransactionId
-------------+--------------
5 | 1
5 | 2
6 | 3
7 | 2
7 ...
0
votes
1
answer
23
views
Invalid Identifier error while using standard_hash function in oracle 11g
I'm trying to generate a hash based on a field but got the following error:
Query:
select standard_hash(pk_time) from schema.table
Error:
"STANDARD_HASH": invalid identifier
The column type ...
-3
votes
1
answer
36
views
Count a table based on another table column [closed]
I have 2 tables, table F and table D. I want to count records from table F based on table D column called 'Oper'. I need to filter values between 160 and 165.
TABLE F
DEP
NUM
SERIAL
01
00001
1
01
...
1
vote
1
answer
35
views
How to effectively "remove" clauses from a query, if no params are provided [duplicate]
I am trying to query some data as part of an APEX form and if a value isn't supplied I basically want to remove the clause for it entirely, or effectively nullify it.
So, let's say I have this query
...
-1
votes
0
answers
33
views
Group function not allowed here [closed]
I am trying to get the count of distinct c.deal_no and use this value in my further calculations, but I get an error.
This is my query:
Select
a.Oa_Permid,
a.NAME,
select
count(...