Results 1 to 2 of 2

Thread: how to execute in sql server?

  1. #1
    Join Date
    Sep 2005
    Posts
    41

    how to execute in sql server?

    i typed this in sql server in oracle windowsnt of plus3.3


    SQL> select * from tab;

    TNAME TABTYPE CLUSTERID
    ------------------------------ ------- ---------
    ATTENDANCE TABLE
    COMPANY TABLE
    COURSE TABLE
    OFFERING TABLE
    SITE TABLE
    STUDENT TABLE
    SUBJECT_AREA TABLE

    7 rows selected.

    SQL> select * from offering;

    OFFERING_ID COURSE_ID INSTRUCTOR_ID SITE_ID START_DAT MAX_NO_STUDENTS
    ----------- --------- ------------- --------- --------- ---------------
    1001 315 700 1 16-DEC-94 24
    1002 315 263 3 16-JUL-95 20
    1003 915 560 7 23-NOV-96 30
    1004 215 263 2 26-SEP-95 24
    1005 815 978 3 15-OCT-95 20
    1006 915 560 4 04-JAN-96 22
    1007 615 453 4 30-SEP-95 30
    1008 515 835 5 20-JUN-95 24

    8 rows selected.

    SQL> select * from course;

    COURSE_ID TITLE DURATION COST SUBJECT_ID
    --------- ------------------------------ --------- --------- ----------
    215 UNIX 5 1995 10
    315 C++ 5 1995 20
    415 ADA 4 1500 20
    515 ORACLE 5 1995 30
    615 SYBASE 3 1200 30
    115 DOS 1 500 10
    715 VMS 2 995 10
    815 NETWARE 5 1995 40
    915 INFORMIX 3 1200 30

    9 rows selected.

    SQL> select * from subject_area;

    SUBJECT_ID SUBJECT_NAME
    ---------- ------------------------------
    10 SYSTEMS
    20 LANGUAGES
    30 DBMS
    40 NETWORKS

    SQL> select * from offering;

    OFFERING_ID COURSE_ID INSTRUCTOR_ID SITE_ID START_DAT MAX_NO_STUDENTS
    ----------- --------- ------------- --------- --------- ---------------
    1001 315 700 1 16-DEC-94 24
    1002 315 263 3 16-JUL-95 20
    1003 915 560 7 23-NOV-96 30
    1004 215 263 2 26-SEP-95 24
    1005 815 978 3 15-OCT-95 20
    1006 915 560 4 04-JAN-96 22
    1007 615 453 4 30-SEP-95 30
    1008 515 835 5 20-JUN-95 24

    8 rows selected.

    SQL> select * from course;

    COURSE_ID TITLE DURATION COST SUBJECT_ID
    --------- ------------------------------ --------- --------- ----------
    215 UNIX 5 1995 10
    315 C++ 5 1995 20
    415 ADA 4 1500 20
    515 ORACLE 5 1995 30
    615 SYBASE 3 1200 30
    115 DOS 1 500 10
    715 VMS 2 995 10
    815 NETWARE 5 1995 40
    915 INFORMIX 3 1200 30

    9 rows selected.

    i tried to type to create the relationship and its:-

    1-alter table offering add constraint offering_pk primary key(offering_id);

    2-alter table course
    add constraint course_fk
    foreign key(subject_id) references subject_area(subject_id);

    3-alter table offering
    add constrain offering_pk
    foreign key(course_id) references course(course_id);

    i tried to excute these but it didnt work why?

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Just run them under correct db in query tool.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •