Everyday SQL (13) interview question

March 15, 2019 lilo 0

We have 3 tables Orders table (ORDER_ID, CUSTOMER_ID, ORDER_DATE) Detail table (ORDER_ID, PRODUCT_ID, PRICE, UNITS) Customers table (CUSTOMER_ID, SIGNUP_DATE, COUNTRY) Data request: can you write […]

Everyday SQL (12)

March 15, 2019 lilo 0

data: code A1 A2 A11 A22 A111 A222 A3333 A4444   We want to select a data set as follows. A1 A2 A11 A22 A111 […]

Everyday SQL (7)

August 21, 2017 lilo 0

There are many interesting usage of sql function, like case when which is super powerful. Hope you can find something interesting or useful from the […]

Everyday SQL (6)

May 31, 2017 lilo 0

这是我工作遇到的问题,从别的组里要来了一堆SQL code,大概是四五年前在那工作的人写的,感觉是old style,之前从没见过,贴出来给大家。 Q: What’s the meaning of (+) in SQL queries (Oracle)?   A: It’s Oracle’s synonym for OUTER JOIN. Example:   SELECT * […]

Everyday SQL (5)

December 7, 2016 lilo 0

Let’s learn 3 functions from http://docs.oracle.com 1. nvl(expr1,expr2) nvl lets you replace null (returned as a blank) with a string in the results of a […]

Everyday SQL (4)

November 4, 2016 lilo 0

ALTER SESSION ENABLE PARALLEL QUERY; ALTER SESSION SET NLS_DATE_FORMAT=’YYYY-MM-DD HH24:MI:SS’; select table1.contact_id,table1.contact_date,table1.people_login ,count(contact_id) over (partition by people_login order by table1.creation_datetime asc range numtodsinterval(365, ‘day’) preceding) […]