Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7934421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:38:31+00:00 2026-06-03T21:38:31+00:00

I created the tables like this: create table utilisateur( id_util number(10) primary key, nom

  • 0

I created the tables like this:

create table utilisateur(
 id_util number(10) primary key,
 nom varchar2(10) not null,
 prenom varchar2(10) not null,
 date_naissance date not null,
 adress varchar2(20)
);

create table cour(
 id_cour number(10) primary key,
 c_nom varchar2(20) not null,
 auteur varchar2(20) not null
);

create table etude(
 fk_util number(10) references utilisateur(id_util),
 fk_cour number(10) references cour(id_cour),
 primary key(fk_util,fk_cour)
);

create table examen(
 id_ex number(10) primary key,
 ex_nom varchar2(20) not null,
 temp date,
 fk_cour number(10) references cour(id_cour)
);

create table passer(
 fk_util number(10) references utilisateur(id_util),
 fk_ex number(10) references examen(id_ex),
 primary key(fk_util,fk_ex),
 note number(4)
);

create table certificat(
 cert_nom varchar2(20),
 prix varchar2(10),
 code varchar2(10) primary key,
 fk_ex number(10),
 fk_util number(10)
);

create table signet(
 id_sign number(10) primary key,
 s_nom varchar2(20) not null,
 depand_par varchar2(20) not null,
 fk_util number(10) references utilisateur(id_util)
);

The problem is that I want to see all the users(utilisateur), which course(cour) they are reading, which exam(examen) they have passed and what certificates(certificat) they have received.

I have tried to do this with inner join, left and right join, full join, view, but without success. If I have 3 courses enregistrated and 2 exams, than I see something repeating. I’m thinking maybe in my database something is wrong.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:38:33+00:00Added an answer on June 3, 2026 at 9:38 pm

    This query

    select utilisateur.nom
           , cour.c_nom
           , examen.ex_nom
    from utilisateur left join etude on utilisateur.id_util=etude.fk_util 
    left join cour on etude.fk_cour=cour.id_cour 
    left join passer on utilisateur.id_util=passer.fk_util 
    left join examen on passer.fk_ex=examen.id_ex;
    

    Doesn’t take into account the fact that an exam is related to a course. I don’t think its necessary to do an outer join for what you are trying to achieve, so try this.

    select utilisateur.nom
         , cour.c_nom
         , examen.ex_nom
    from utilisateur join etude on utilisateur.id_util=etude.fk_util 
                     join cour on etude.fk_cour=cour.id_cour 
                     join passer on utilisateur.id_util=passer.fk_util 
                     join examen on cour.id_cour = examen.fk_cour;
    

    Edit : This was a bit more complicated than it first appeared to me, I’ve added a new solution below. The first thing I did was add some aliases to the query, there is an issue with doing ansi joins between 3 or more tables if you don’t use aliases on certain versions of oracle. Aliases being generally a good thing, I’ve added them in anyway. I also moved some of the tables into inline views, to make the problem clearer to myself as much as anything. Aside from this tidying up, the only real change I’ve made is to add this line :-

    AND paex.id_ex = coex.id_ex

    I’ve tested this query against some data that I created as you described, and it seems to do what you want.

        SELECT ut.id_util
      ,ut.nom
      ,coex.c_nom
      ,paex.id_ex
      ,paex.ex_nom FROM   utilisateur ut LEFT JOIN (SELECT c_nom
                 ,ex_nom
                 ,co.id_cour
                 ,id_ex 
                 ,et.fk_util               
           FROM etude et JOIN cour co ON et.fk_cour = co.id_cour
                    LEFT JOIN examen ex2 ON co.id_cour = ex2.fk_cour) coex ON coex.fk_util = ut.id_util LEFT JOIN (SELECT *
           FROM passer pa JOIN examen ex  ON pa.fk_ex   = ex.id_ex) paex ON paex.fk_util = ut.id_util 
                                                                        AND paex.id_ex = coex.id_ex ORDER BY id_util;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating two tables like this: CREATE TABLE abc ( id INTEGER NOT NULL
I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY
I have something like this: create table account ( id int identity(1,1) primary key,
I have two tables like this create table A_DUMMY ( TRADE_ID VARCHAR2(16) TRADE_DATA VARCHAR2(500)
I've created a table like this : create table tbl( address varchar(5000)); If i
I have a table created like this: CREATE TABLE rh857_omf.picture(MeasNr TINYINT UNSIGNED, ExperimentNr TINYINT
I have created an index on my table like this: CREATE INDEX index_typ_poplatky ON
If my table looks like this: CREATE TABLE `daily_individual_tracking` ( `daily_individual_tracking_id` int(10) unsigned NOT
I have two tables in my database that look like this CREATE TABLE IF
I created a simple test case: CREATE TABLE `t1` ( `id` int NOT NULL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.