Skip to content

Tag: sql

Missing expression inside sub-query statement?

I am using the infamous “CityJail” schema to answer a question “List the names of all criminals who have committed more than average number of crimes and aren’t listed as violent offenders.” Here is my code: but I get an error: ORA-00936: missing expression 00936. 00000 – “…

SQL SUM of Article-Prizes

i’m an absolute newbie in SQL and want to add up all the Sums of the Articles * ordered amount to a final prize. I tried to calculate the Articles * amount to the “Gesamtpreis” and then the Method SUM() to sum up all the “Gesamtpreis”. Dont worry, the SQL-Code is auto-generated b…

Simple SQL CASE Question – from WHERE to CASE function

Sorry for the noob question, new to SQL here and would appreciate help 🙂 I have this SQL query: Will I have the same result if I use this query? (Am I applying the case function correctly here?) If not, can someone help me fix the query below, if possible? *EDIT The original query actually went like this, and…

Convert month and year as last day of the month in oracle sql

I have two column – Month and Year in a table. Need to concatenate these to get the last day of the month in date format. For example, if Month =5 and Year =2020, the output needs to 31-May-20. Similarly if Month =4 and Year=19, the output needs to be 30-APR-20. Any idea how this can be done, is there