X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3107253423 for ; Tue, 26 Apr 2005 17:18:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05152-04 for ; Tue, 26 Apr 2005 20:18:04 +0000 (GMT) Received: from hotmail.com (bay101-f11.bay101.hotmail.com [64.4.56.21]) by svr1.postgresql.org (Postfix) with ESMTP id B7A24540A2 for ; Tue, 26 Apr 2005 17:18:00 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 26 Apr 2005 13:18:01 -0700 Message-ID: Received: from 64.4.56.203 by by101fd.bay101.hotmail.msn.com with HTTP; Tue, 26 Apr 2005 20:18:01 GMT X-Originating-IP: [64.4.56.203] X-Originating-Email: [xdarknessx82@hotmail.com] X-Sender: xdarknessx82@hotmail.com From: "Lord Knight of the Black Rose" To: pgsql-sql@postgresql.org Subject: can someone jelp me on this? Date: Tue, 26 Apr 2005 20:18:01 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 26 Apr 2005 20:18:01.0338 (UTC) FILETIME=[0B82F5A0:01C54A9D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.266 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FROM_ENDS_IN_NUMS, MSGID_FROM_MTA_HEADER X-Spam-Level: ** X-Archive-Number: 200504/403 X-Sequence-Number: 21296 hey guys I have a question that I couldnt maneged to solve for the last 4 days. Im kinda new to these stuff so dont have fun with me if it was so easy. Ok now heres the question. create table student (student_id int not null, student_name varchar(25), student_affiliation int, student_password varchar(20), student_email varchar(30), student_phone varchar(12), student_address varchar(50)); create table instructor (instructor_id int not null, instructor_name varchar(25), instructor_affiliation int, instructor_password varchar(20), instructor_email varchar(30), instructor_phone varchar(12), instructor_address varchar(50)); create table course (course_id int not null, course_name varchar(25), course_sections int, course_description varchar(50)); create table class (course_id int not null, class_section int not null, class_strength int, class_date date, class_time time); create table student_class (course_id int not null, class_section int, student_id int not null); create table instructor_class (course_id int not null, class_section int, instructor_id int not null); insert into student (student_id, student_name) Values (1, 'Marge Trechle'); insert into student (student_id, student_name) Values (2, 'Todd Relve'); insert into student (student_id, student_name) Values (3, 'Beth Schavinsky'); insert into student (student_id, student_name) Values (4, 'Thomas Newburry'); insert into student (student_id, student_name) Values (5, 'Geoff Hamilton'); insert into student (student_id, student_name) Values (6, 'Cindy Crumple'); insert into student (student_id, student_name) Values (7, 'Keith Snyder'); insert into student (student_id, student_name) Values (8, 'Belinda Myers'); insert into student (student_id, student_name) Values (9, 'Hope Wilson'); insert into student (student_id, student_name) Values (10, 'Icculus McMan'); insert into student (student_id, student_name) Values (11, 'Mary Calahan'); insert into instructor (instructor_id, instructor_name) values (1, 'Norm Salvadori'); insert into instructor (instructor_id, instructor_name) values (2, 'Terry Smith'); insert into course (course_id, course_name) values (1, 'Wetlands Critters'); insert into course (course_id, course_name) values (2, 'Ocean Ecosystems'); insert into course (course_id, course_name) values (3, 'Endangered Habitats'); insert into class (course_id, class_section) values (1,1); insert into class (course_id, class_section) values (1,2); insert into class (course_id, class_section) values (2,1); insert into class (course_id, class_section) values (3,1); The values inserted into the database can change and more entries can be inserted and in this situation I have to write the constraints according to these criteria: 1. A COURSE may consist of one or more CLASSes 2. An INSTRUCTOR may teach one or more CLASSes 3. A STUDENT may enroll in many CLASSes 4. A STUDENT can take more than one CLASS, and each CLASS contains many STUDENTS 5. A CLASS is taught by only one INSTRUCTOR, but an INSTRUCTOR can teach many CLASSes 6. A COURSE consists many CLASSes, while each CLASS is based on one COURSE, so there is a one-to-many relationship between COURSE and CLASS 7. A STUDENT may not enroll himself/herself for two CLASSes of the same course 8. An INSTRUCTOR may not teach two CLASSes of the same COURSE İf someone can help me about these stuff I will really apreciate.