I have an Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 on Windows 2019 (64bit). In short, when importing a dump file I’m getting the following: IMP-00403: Warning: This import generated …
Oracle – How to partition by case statement
I have the following Oracle SQL in a report that I inherited. The bucket1_days_prc and overdue_prc should show the percentage of the number of invoices that falls within those buckets based on the …
STUFF doesn’t work well with NULL Values and Grouping
I have table with below schema and data. CREATE TABLE [dbo].[SearchTest] ( [DocumentNumber] [int] NOT NULL, [AlphaNumeric] [nvarchar](50) NULL, [Integers] [int] NULL ) ON [PRIMARY] GO …
SQL Substract 2 colums in same table
I’ve table named ‘detail_transaksi’. I want to SUM all of the data in “jumlah” column where “debit_kredit” = ‘D’ which is grouped in the same “kode_akun” data. Also, I want to SUM all of the data in “…
Django Sql ERROR 1064 when accessing table
I cannot access one of the tables in my database. I can’t even delete the table by myself, so I am not sure what to do. Here is the error: ERROR 1064 (42000): You have an error in your SQL syntax; …
How to ignore duplicates without unique constraint in Postgres 9.4?
I am currently facing an issue in our old database(postgres 9.4) table which contains some duplicate rows. I want to ensure that no more duplicate rows should be generated. But I also want to keep the duplicate rows that already has been generated. Due to which I could not apply unique constraint on those col…
How to select unique sessions per unique dates with SQL?
I’m struggling with my SQL. I want to select all unique sessions on unique dates from a table. I don’t get the results I want. Example of table: session_id | date 87654321 | 2020-05-22 09:10:10 …
How to calculate the difference in revenue for 2 specific periods from data in a single table?
I am using SQL Server 2014 and I have the following T-SQL query which is supposed to calculate the difference in total revenue based on 2 specific periods. The data to perform the computation come …
insert into a table from another table and add value from variable also in one SQL code
i am using INSERT INTO SELECT Statement Syntax to insert values from another table into my main table in my php project $student_id=1; // dummy id set in a variable include ‘conndb.php’; $sql = “…
SQL JOIN with WHERE condition when two rows’ values are the same and one row matches to two different rows
I have these tables: CREATE TABLE students( id int NOT NULL PRIMARY KEY, name VARCHAR(30) NOT NULL ); CREATE TABLE studentsActivities( studentId int NOT NULL, activity VARCHAR(30) NOT NULL, …