Results 1 to 3 of 3
  1. #1
    acdougla17 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    4

    Homework problem (dont understand what is being asked)

    So I am doing a homework assignment where we need to write SQL queries using the "plain english" explanations given. There is one problem that I just cant make sense of what it is asking.

    Display all the columns in Title for those that dont have any rows in Employee.


    Title contains the columns code, name, min_salary, max_salary


    Employee contains id, dcode, tcode, ssn, last_name, first_name, middle_init, hire, salary
    I am pretty sure Title.code and Employee.tcode are the 2 being used.

    My attempt at this (even though I dont know what the output is even supposed to be) is...

    SELECT DISTINCT Title.*
    FROM Title, Employee
    WHERE Title.code<>Employee.tcode;

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    You may want to look at some samples at
    http://www.techonthenet.com

    There are some sql samples - here is one

    http://www.techonthenet.com/access/queries/joins2.php

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    I will make a guesstimate instructor wants you to determine which Title records have not been associated with a record in Employee. Assuming Title.code and Employee.tcode are related key fields, query the tables with a join. Try:
    SELECT Title.code, Title.name, Title.min_salary, Title.max_salary, Employee.tcode
    FROM Employee RIGHT JOIN Title ON Employee.tcode = Title.code
    WHERE (((Employee.tcode) Is Null));

    The second link given by Orange is a good guideline for this.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need to understand code
    By accessnewb in forum Programming
    Replies: 2
    Last Post: 08-03-2011, 12:03 PM
  2. Replies: 2
    Last Post: 07-11-2011, 05:34 AM
  3. Replies: 1
    Last Post: 09-16-2010, 01:29 PM
  4. Help me to understand forms
    By RTaylor in forum Forms
    Replies: 0
    Last Post: 04-10-2010, 01:36 AM
  5. Replies: 3
    Last Post: 02-27-2009, 08:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums