Skip to content

Tag: oracle

How to add column with specific condition for oracle DB

How do add a field – DOC with Date type to the Registration table. Also DOC (Date of Completion) should be greater than DOJ (Date of joining). I wrote this query but it is showing error : Column check constraint cannot reference other column Answer Add both the DOC column and the CHECK constraint with a singl…

Maximum mark in Subject with Staff name

Write a query to display list of staff name, subject name handled, maximum mark scored in that subject. Give an alias to the maximum mark as max_mark. Sort the result based on maximum mark in descending. This is the schema diagram. This is the code I have tried. I was abled to pass one testcase but I could no…

Oracle Case Statement Query

I am working on an Oracle Query to find if Diagnostic Pack is installed. Query is working fine. In the Output I need to add another Column Installed. So if currently_used = ‘TRUE’ I need the output to be displayed as below. I am running into an issue with the INSTALLED Column in the case statement…

Stop Printing double values SQL

Hello Guys! Oracle SQL I am trying to find a way to stop my sql Query print duplicate values. For example Results coming for a table are: The result I want: Thanks in advance! Answer Use DISTINCT to remove duplicate values :

Join on same column multiple times

how do I join on the same column multiple times, one of the tables is a configuration table with values and other is the data table. T1: T2 (Config table): I need to display the code and its relevant description for each ID. Expected Output: This is what I have tried so far, however, it is not giving me the