Skip to content

SQL SELECT statement with a many-to-many extra table

I have a table that links users. Consider the following: The user_links table can have 0 rows for a particular user_id, given the user doesn’t have linked users, so a select statement can return either a row or NULL. The approach with left join user_links ul on ul.user_id = contracts.user_id OR ul.linke…

Add minutes to an Oracle date

I am trying to add minutes to my sql but no error and no data. This is my sql And I want to add 5 minutes to (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’) So I want my sql show me after 5 minutes for this column (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’) I wrote sql like that And after 5 minu…

Converting weight to grams in a SELECT statement

I have a Table called parts which looks like this: Now I want to select the PNO, color,weight and city for “non-Paris” parts with a weight greater than ten pounds. This is not that difficult: Now to the part I don’t understand. How can I add a column to my result which shows the weight conve…

Oracle SQL ignores condition in WHERE clause

I have this simple part of SQL query I have 4 parameters, invoice_num, start_date, end_date and Payee, I want it to be just like a filter, If one of the conditions above is present then it must be applied, if not present then it must be ignored, but it just doesn’t work as expected, if I pass invoice_nu…