Skip to content
Advertisement

Relational Databases: Is it fine to have a foreign key referencing an Associative table?

Lets say we have Passengers, where Passengers can attend many Flights, and one Flight may have many Passengers. In each Flight, each Passenger has a unique selection of Movies he/she can watch. For Passengers, Flights, and the association between them, we have three tables: For Movies, it must specify for which Passenger and for which Flight will it be available

ORACLE SQL: Group the data by the last 4 weeks

i have a trouble with dates, i need to do a query that count the ids from the last four weeks. I tried this, but it doesn’t works. SELECT count(a.id), sysdate FROM table_1 a, table_2 b WHERE b.fk_id …

Make Entire Result set into a Single Row

i have to convert the entire result in Oracle into a single row result set with different column names I have tried with some self joins but not appears to be working . Expected output

Aggregate Functions And GROUP BY

I have following query as homework for sql:- Write a query that tells how many books each author has written. On each row provide first the authorid, followed by the number of books. Order the …

How To Use Latest Date As A Condition In Query

I have a few table, and one of it is “peminjaman” which have “date” atribute type in it, which is “tarikhpemulangan” example=”2019-07-23″ . I want to select from “peminjaman” where the atribute “…

Unpredictable behaviour in nested CASE statement

I’m unable to figure out why the control goes always to a statement irrespective of inside CASE condition. A normal SQL statement works, but with my table it does not work. –Not working– SELECT …

Advertisement