I have two dates : Date1: 20-Mar-2020 07:35:00 PM and Date2: 20-Mar-2020 02:42:00 PM I have written the query : SELECT ROUND(minutes / 60, 2) || ‘ Hours ‘ FROM ( SELECT (Date1 – to_date(…
Tag: oracle
Oracle FETCH FIRST 1 ROW with UNION ALL statement
I’m trying to create a UNION ALL statement in SQL using the FETCH FIRST 1 ROW however when I do that it gives me an error MISSING KEYWORD Here’s what my SQL looks like: is something like this doable. I would like to keep this as a single statement rather than adding a SUBQUERY or anything of that …
How to check if hotel room is booked using Oracle SQL constraints
I am an absolute beginner when it comes to SQL, and I’m trying to figure out how to do a simple integrity check. I am modelling a hotel registration system with four tables: Hotel, Room, Booking and …
How do I partially share param values across union selects using different constraints?
I have a view create or replace view v_collected as select car.id_car ,car.state_car ,[..] from cars car ,garages garage ,[..] where [..] Which is at least …
SQL COUNT with condition and without – using JOIN
My goal is something like following table: With two simple selects I could gain this values: (the key of the table consists of 3 columns [t$ncmp, t$trav, t$seqn]) How can I join these statements? What I tried: I tried different variantes, but always got errors like ‘group by is missing’ or ‘…
PL/SQL change value in 1 row in procedure
i do not know where the bug is. I must write the procedure where the 1 specific row will be chaned. Everytime i lunched it, wrote me: Errors: PROCEDURE RENAME_FLYTICKET Line/Col: 1/65 PLS-00103: …
Which join or approach to use
I have two tables. First table contains names of individual teams and teamID which is PK. Second table contains details about matches: homeTeamID, awayTeamID, result. I somehow need to combine these two tables in which I would have names (not IDs) of home and away team and the result of a match. How to achiev…
Does SQL’s EXISTS function select duplicates? (Oracle SQL)
t1 has all the credits of each person in a given ORACLE database. Each person is identified by ID. t2 contains the people I need to select from t1. To do this, I tried the following: My problem is that t2 has duplicate IDs. So for example, if ID = 2 has 3 credits and she is repeated 4 times
Update Oracle SQL Query in a procedure but throwing missing right parenthesis error
The table sc contains the student id and the course id they attended, followed by it’s corresponding grade. The table course contains the course id and corresponding credits The table student1 contains the student id and corresponding info. In this case I need to calculate the average score of every stu…
How to overcome the problem. If manager is not available then display manager name ‘NA’. If phone number is not available then display as ‘NA’
I have written the query like: Problem is, I’m not getting the output containing null values Answer A regular (inner) join will only return rows that match the join condition. You’re looking for a left join: