This is the output, but I need those values changed. I have ID primary keys for both – kasutaja and riistvara, but I don’t know how to match kasutaja ID 1 with riistvara ID 2 and vice versa. And the output should be like this: The R_NIMETUS and SEERIA_NR fields are different on my output what I ge…
Tag: oracle
Count values between double quotes and brackets
How can I group by and count the values separated by double quotes between the brackets? I have 400K rows, so I’m also concerned about performance. Desired output: Answer Do you mean something like this? (The with clause is only for testing – remove it, and use your actual table and column names i…
(Error) ORA-02270: no matching unique or primary key for this column-list
I have the code below and I’m running it step by step: CREATE TABLE registration ( constraint pkks primary key (cod_class, number_rgm), cod_class NUMBER(8), number_rgm …
ORDER BY DECODE: Decode won’t reorder the days like I want it to
I’ve got an assignment where I need to return a certain report and then order it by the day, but I need Monday to be day #1 (by default, Sunday is day #1 in SQL). Here’s my code for the report and the …
Sum with two column is SQL Oracle
I have two columns in a SQL table and I need a third column with the sum of the other two. It’s possible to add a calculated column? Answer Yes it is possible. I did this in the following query, of course, if the columns are numeric If you want to combine two columns, use the following query
Oracle sql REGEXP to split a string at certain point so as to maintain the meaning- Suggestions required
I have a string for more than 40 characters and wanted to split it into two meaning full strings to set it into two different fields. Example: SELECT ‘THIS LONG STRING HAS EIGHT WORDS SEVEN SPACES’ …
Why selecting a single attribute returns less rows than selecting all columns in oracle SQL
The tables created and the queries made are not the primary focus of this question, what confuses me is that why the first query and the second query returns different numbers of rows I want to find the sid of the sailors who have not ordered all the red boats, the first query above returns the correct rows I…
Oracle SQL – Define the year element of a date dependent on the current month
I am trying to create a view in SQL Developer based on this statement: SELECT * FROM ORDERS WHERE START_DATE > ’01-JUL-2020′ The year element of the date needs to set to the year of the current date if the current month is between July and December otherwise it needs to be the previous year. Th…
LISTAGG in SQL is returning a row with null values
I have 2 tables A and B, B is having a foreign key relationship with A i.e.,(b.detail_id = a.id) I want to apply LISTAGG query on one of the column in B. The above query is returning me a row with all values as null, But I want no rows. How can I achieve this? If it’s not possible any
Oracle how to select and update one field value and insert records quickly
We have the below scenario: create table create table tt (id number, name varchar2(30), note varchar2(4)); insert into tt values (1,’AC’,’m’); insert into tt values (2,’Test’,’f’); we want to select …