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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:28:46+00:00 2026-06-04T21:28:46+00:00

I’m still learning how to use SQL, and I need some help creating this

  • 0

I’m still learning how to use SQL, and I need some help creating this database.

I’ve created the following tables:

create table Worker
(Num_Worker number(20) PRIMARY KEY,
Name varchar2(30),
ID number(8),
Password varchar2(20));

create table Area
(Code_Area number(10) PRIMARY KEY,
Name varchar2(30),
Current_workers number(2)
Max_workers number(2));

create table Timetable
(ID_Timetable number(10) PRIMARY KEY, 
Time_Entrance date,
Time_Exit date,
Code_Area number(10),
Num_Worker number(20),
Foreign Key (Num_Worker) references Worker(Num_Worker),
Foreign Key (Code_Area) references Area(Code_Area));

Supposedly, each worker can choose a area to work at, but each area has a limit or workers at the same time.

What would happen is a worker would create a new timetable, but before that timetable is created it should check the area that he chose to check if the “Current_workers” is the same value as “Max_workers”, and if it is it shouldn’t let it happen.

I’ve been trying to create a trigger for that, but I’ve had no luck in finding the correct syntax for it, and I’m not sure how to do it either, or if there’s a better way to do it than with a trigger.
This is all I’ve done so far:

create trigger limit_worker_per_zone
before insert
on Timetable
for each row
as
 BEGIN
  if (select Current_Workers from Area) >= (select Max_workers from Area) <-Not sure...
  BEGIN
    ???
  END
 END

I’d really appreciate if you can help me in this. I’ll still be looking for more info myself meanwhile, but the more help the better.

  • 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-04T21:28:49+00:00Added an answer on June 4, 2026 at 9:28 pm
    CREATE TRIGGER limit_worker_per_zone
    BEFORE INSERT
    ON Timetable
    FOR EACH ROW
    DECLARE
     v_total NUMBER;
     BEGIN
       BEGIN 
        SELECT max_workers - current_workers
        INTO v_total
        FROM Area
        WHERE Code_Area = :NEW.Code_Area;
        exception when no_data_found then
           v_total := 1;
        END;
     IF v_total <= 0 THEN
       raise_application_error(990000, 'workers full for this area');
     END IF;
    END limit_worker_per_zone;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported

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.