473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

modify sql code

10
How can I change the below oracle sql code so that: The current enrollment of an offering must be less than the maximum enrollment.


Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE COURSES
  2.   (COURSE VARCHAR(6),
  3.    DESCRIPTION VARCHAR(60),
  4.    CREDITS INT,
  5.    CONSTRAINT pk PRIMARY KEY (COURSE));
  6.  
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE OFFERINGS
  2. ( CRN INT,
  3.   COURSE VARCHAR(6),
  4.   SECTION VARCHAR(2),
  5.   DATES VARCHAR(5),
  6.   TIMES VARCHAR(30),
  7.   INSTRUCTOR VARCHAR(30),
  8.   ROOM VARCHAR(20),
  9.   ENROLLMAX INT,
  10.   ENROLLCURRENT INT,
  11.   CONSTRAINT pk2 PRIMARY KEY (CRN),
  12.   CONSTRAINT fk1 FOREIGN KEY (COURSE) REFERENCES COURSES (COURSE));
  13.  
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE STUDENTS
  2. ( USERID VARCHAR(9),
  3.   PASSWORD VARCHAR(10),
  4.   FIRSTNAME VARCHAR(20),
  5.   LASTNAME VARCHAR(30),
  6.   PHONE VARCHAR(12),
  7.   DOB VARCHAR(40),
  8.   MAJOR VARCHAR(20),
  9.   ADDRESS VARCHAR(30),
  10.   CITY VARCHAR(30),
  11.   STATE VARCHAR(2),
  12.   ZIP VARCHAR(5),
  13.   CONSTRAINT pk3 PRIMARY KEY (USERID));
  14.  
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE ENROLLMENTS
  2. ( CRN INT,
  3.   USERID VARCHAR(9),
  4.   ENROLLDATE VARCHAR(30),
  5.   GRADE VARCHAR(2),
  6.   CONSTRAINT pk4 PRIMARY KEY(CRN, USERID),
  7.   CONSTRAINT fk2 FOREIGN KEY (CRN) REFERENCES OFFERINGS(CRN),
  8.   CONSTRAINT fk3 FOREIGN KEY (USERID) REFERENCES STUDENTS(USERID));
  9.  
Apr 1 '15 #1
0 1196

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: python | last post by:
hello and thanks for reading this, i have been a dos/windows user using some form of the basic language for 30 years now. i own and run a small programming company and there is one feature that...
2
by: jdph40 | last post by:
In Access 97, I have a form named frmEmpList with a list box that contains the names of all our employees. I have a command button with the following code in the OnClick event so the form will...
2
by: Baldy | last post by:
Hi All is it possible to modify code at run time? I have a set of constants that change at deployment (from development to deployment server and a few other consts) I have a menu item that...
4
by: William | last post by:
After much frustration I was able to update my data store via code only. Using the data adapter was the only way I was able to set up all the objects written in my code. Basically, I cheated by...
0
by: richardkreidl | last post by:
I have the following hash script that I use to compare two text files. 'Class Public Class FileComparison Public Class FileComparisonException Public Enum ExceptionType U 'Unknown A 'Add...
1
by: Krishna | last post by:
In vb2005 I can't modify code in debug mode why? Is it possible to set? Thanks
8
by: Jesse Aldridge | last post by:
I've got a module that I use regularly. I want to make some extensive changes to this module but I want all of the programs that depend on the module to keep working while I'm making my changes. ...
1
by: G Love | last post by:
Hi, I am trying to modify some code in a toolbar I have for generating random 'spam' entries on my forum. I have managed to extract all the relevant files from the firefox .xpi file and the .jar...
3
by: erynn | last post by:
how to declare to multiply a matrix by a constant value 3? the value of matrix given is A: 5 -1 6 2 7 -1 4 3 -5 B: 3 7 -2
10
by: timleonard | last post by:
How can the following code to be modified to include a duration Column or "Named Range"? I would like to modify it so that a task that has a duration for example, three to five days would show...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.