Skip to main content
The 2024 Developer Survey results are live! See the results

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.

-3 votes
0 answers
53 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, ...
Soob's user avatar
  • 1
-1 votes
0 answers
13 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 ...
Corina Roca's user avatar
-1 votes
0 answers
54 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'...
Dave Quested's user avatar
-1 votes
0 answers
41 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 ...
Mikano's user avatar
  • 31
-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 ...
daxnewbie's user avatar
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 ...
Lasse Staalung's user avatar
0 votes
1 answer
41 views

Get all hierarchy in SQL Server

I have a table like this: ID_employee ID_Manager 1 1 2 1 3 1 4 2 5 3 6 5 7 5 8 5 (1 is a boss) What I would like is a result like: ID_employee ID_Manager 8 5 8 3 8 1 7 5 7 3 7 1 6 5 ...
Mr Alsi's user avatar
  • 27
0 votes
1 answer
27 views

Deduplication based on other dataframe columns

I have pyspark df1 as +----+ |name| +----+ | A| | B| | C| | D| +----+ and df2 as +------+------+ |name_a|name_b| +------+------+ | A| B| | B| A| | C| A| | A| C|...
abd's user avatar
  • 81
1 vote
1 answer
24 views

How to convert a row from a table to ENUM in JOOQ?

JOOQ does not convert rows from a table to enum I tried different conversion methods, but they either didn't do anything, or they displayed errors, I tried to add codegen jooq, but I can't do it, I ...
Будь как Я's user avatar
0 votes
0 answers
13 views

Navicat 16 Backup Error: 'column d.datlastsysoid does not exist' for Postgres 15.4 Database [duplicate]

I am using Navicat 16 to back up my remote PostgreSQL database, which is running version 15.4. However, during the backup process, I encounter an error that reads: [ERR] ERROR: column d.datlastsysoid ...
7Aom1's user avatar
  • 1
1 vote
1 answer
59 views

INSERT rows that were missing for the UPDATE

I want to write a query that, if I was using variables, would look something like (pseudocode) records = SELECT * FROM table_1 WHERE id = x numberOfRowsUpdated = UPDATE table_2 SET column_1 = y WHERE ...
Marco Groot's user avatar
0 votes
2 answers
42 views

Select user's high score for each lesson from one table based upon lesson ids in another table

I have a site that has multiple courses and each course has multiple lessons. I would like to select the highest score per LESSON for a given user_id and course_id ordered by lesson_order. TABLE ...
Your Worshipful Heart's user avatar
-1 votes
0 answers
45 views

Session variable into a prepared statement [closed]

When I submit a form, I would like the Session variable user_id to carry through to my prepared statements so it can be inserted into my table. Code of dev.inc.php (following comments...) <?php if(...
Matt Drake's user avatar
-2 votes
0 answers
22 views

insert in to target table and avoid the rows with same set of column value from source to target [duplicate]

-- Create a temporary table with sample data CREATE TEMPORARY TABLE temp_student ( roll_no INT, name VARCHAR(50) ); -- Insert some sample records into the temporary table INSERT INTO ...
Jagan Kesavan's user avatar
0 votes
2 answers
48 views

Is there any method to convert a varchar with specific format into time in Oracle SQL?

I have a table with three columns, one of the columns ateststatus_date has the following format: e.g: 28-MAY-24 11.57.20.000000 PM and it's defined as varchar(2). I used To_date() and ...
Matt's user avatar
  • 11

15 30 50 per page