I want to add a column that auto generates value depending on other tables. There are 2 tables to work with. Table “finance” : Table “price” : And by executing this command I get this result I wanted to make the revenue_x_10 auto generated by doing something like this. But looks like I…
Tag: sql
Insert a record into database and associate it to a record in another table without the id
This may be a duplicate question, but I do not know the terminology to use to search for the answer. I have an account table with the following fields: id email And a widget table with the following …
Alternative way to run a query with join
I have the below query: select m.name, m.surname,m.teacher, c.classroom,c.floor from table1 as m inner join table2 as c on (m.name=c.name or m.surname = c.surname); But it takes a lot of time to …
how to pass in array in procedure call in oracle
I have a procedure that takes in an array in postgres, this syntax works: SELECT * from myMethod(array[‘test’,’test’], array[”], 554, 73430, 322234, ‘shazam’); the array keyword is what I am …
How to calculate the degree of agreement by row comparisons in SQL Server?
For a minimal, reproducible example (reprex) let’s assume I have a database object (dbo) in a Microsoft SQL Server and I want to query things in T-SQL. My dbo looks like this: Animal-ID Marker-ID …
Sum some columns order by ID in SQL [closed]
I’m trying to sum some columns by id. But I’m retrieving 1 raw. For Example Id | C1| C2| ——————————— 1 | 2 | 1 | 2 | 5 | 4 | 3 | 3 | 1 | 4 |…
Error in SQLite ‘all VALUES must have the same number of terms’
Glad to be a part of this platform among you, highly experienced programmers, Nowadays I am working on a POS system project in python, using tkinter for frontend & Sqlite as the database. While putting data into it, I am facing this issue. ”’ ”’ What I am trying to do here is retri…
Need to modify a variable data to use as a “LIKE” in a COUNT query
I’m trying to use a numeric variable on a LIKE statement, but I do not know how to change the data to a numeric value. Before we start, I apologize because I can’t copy the table structure as I’m …
Oracle SQL where clause does not work for some dates
Below query works fine with the recent dates (for e.g. if the date is 20-JUN-16, 30-SEP-19). But if I query with date value set to 29-MAR-80, 01-JAN-94 it does not return any result. Wondering what could be the reason. Am not allowed to change the existing year format to YYYY. We are on Oracle 19c. Answer Her…
Find items in table with 2 specific sizes
I have items table where the item code repeats as it has different sizes, variants. I want to find items which has 2 specific sizes, ie size in both M/Y and Euro. Items table: Required, I want to query for item id 1 and 3. I was trying with SUM(), CASE but not able to figure it as it involves