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 9188209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:57:02+00:00 2026-06-17T19:57:02+00:00

I am new to using SQL developer. This is hw for my class, and

  • 0

I am new to using SQL developer.

This is hw for my class, and I’ve created employee – manager relationship table.

and for case a. if a manager loses his job, then the manager field should be set to null.

and for case b. if a manager loses his job, then his employee also loses his job.

my table looks like this

lastName | jobTitle | Department | employeeID | fk_employeeID | fk_employeeID1

I am not sure why I get 2 employeeIDs.

here is my DDL code:

CREATE TABLE Employee
(
    lastName varchar (255),
    jobTitle varchar (255),
    Department varchar (255),
    id_Employee integer,
    fk_Employeeid_Employee integer NOT NULL,
    fk_Employeeid_Employee1 integer,
    PRIMARY KEY(id_Employee),
    UNIQUE(fk_Employeeid_Employee),
    FOREIGN KEY(fk_Employeeid_Employee) REFERENCES Employee (id_Employee),
    FOREIGN KEY(fk_Employeeid_Employee1) REFERENCES Employee (id_Employee)
)

I think I have to use “on delete cascade” for a and b, if you know how to do it, please help.

  • 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-17T19:57:04+00:00Added an answer on June 17, 2026 at 7:57 pm

    Probably a little late for your homework, but in case someone else comes along.

    CREATE TABLE Employee
    (
        lastName varchar (255),
        jobTitle varchar (255),
        Department varchar (255),
        id_Employee integer,
        fk_Employeeid_Employee integer NOT NULL,
        fk_Employeeid_Employee1 integer,
        PRIMARY KEY(id_Employee),
        UNIQUE(fk_Employeeid_Employee),
        FOREIGN KEY(fk_Employeeid_Employee) REFERENCES Employee (id_Employee)
        ON UDPATE CASCADE ON DELETE SET NULL,
        FOREIGN KEY(fk_Employeeid_Employee1) REFERENCES Employee (id_Employee)
        ON UDPATE CASCADE ON DELETE SET NULL
    )
    

    I am not sure why you have multiple fk_employeeIDs… I am assuming this is the id of the employee’s manager. If this is the case, the code above should do what you want. If the manager is deleted, the fk_employeeID fields will be set to null. Also any changes to the manager’s id will be reflected in the foreign key field.

    Hope that helps,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to PL/SQL, and am using Oracle SQL Developer to write a
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; Kinda new at C# here.. I got the first row
I'm reasonably new to using SQL, so I apologise if this is a newbish
I am a java Developer,new to C# silverlight. in this class I want to
I'm new to using Oracle SQL Developer and to using an Oracle DB (have
I want to mention that I'm new using sql developer and I'm trying to
New to SQL. Using oracle sql developer Version 3.1.07. Is there any way to
I am very new to using SQL and I haven't been able to find
I am pretty much new to using SQL Server 2000. I have been using
Does anyone know how to insert a new post into Wordpress using sql?

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.