I’m querying database by a simple SQL like: SELECT DISTINCT label FROM Document WHERE folderId=123 I need a best index for it. There are two way to implement this. (1) create two indexes CREATE …
Tag: sql
Create sql pivot on more row&column
I have to combine in PIVOT multiple columns / rows. let me explain with an example: My start table: PriceListId | ItemId | Stock | PriceIT | PriceES | PriceAT | OriginPriceListId 28 | 25760 | 51 | …
What is wrong with this running total (cumulative column) in Oracle select with a window function?
I have a query containing 0 or 1 in a column. For demonstration purposes I replaced the 1 with 77 so its more easy to see: select dates.d the_date , case TO_CHAR(dates.d, ‘d’) when ‘7’ then 0 when ‘1’…
Navicat SQL Consol in table, set record=itself/10
UPDATE `kingdom`.`monsterinfos` SET `PlusCps` = `PlusCps`/10 on table monsterinfos how to set all pluscps records to itself/10 on navicat console.
Migration MYSQL to ORACLE
right now am working on database migration from MYSQL TO ORACLE. I have experience in MySQL but not in Oracle, So help me to convert the following MYSQL query to ORACLE Mysql query: SELECT MIN(id) …
Join two table with specific conditions in mysql
I have two table Table 1: (user) id,name,username,password table 2: (order) id,user,status status column have two value: 1(cancel order) or 2(success order) I want show all user list with order …
specific select within sql server
I have a table vbap : For all distinct POSNR, PARVW, I need to check if POSNR=POSNR2, if it’s the case I select KUNNR. if POSNRPOSNR2 and POSNR2 =’00000′ I select KUNNR Result: I didn’t …
Update jsonb column with value from row_to_json()
I have a table containing a data that look like: col1 col2 col3 col4 json_data —————————————————- a b c d {“mock”:”…
Change empty string to NULL when column has DATE constraint
This might be impossible but I was wondering if someone more experienced knew if this is possible to do in postgresql. I have a column in my create statement CREATE table IF NOT EXISTS (other cols, …
Get totals from difference between rows
I have a table, with the following structure: ( id SERIAL PRIMARY KEY, user_id integer NOT NULL REFERENCES user(id) ON UPDATE CASCADE, status text NOT NULL, created_at timestamp with …