SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Team member birthdays, cities, and teams (was "easy for you")

    hi, first time using sql with sql*plus and hoping 2 get some help with a few questions ive been asked, the scema is

    Member(member_id, member_fname, member_lname, member_DOB,
    member_city)
    Sport(sport_id, sport_name)
    Team(team_id, team_name, sport_id)
    Member_team(member_id , team_id)
    Member_sport(member_id, sport_id)


    List the names and the date of birth of all the members who were born in 1975.

    SELECT member_fname
    FROM Member
    WHERE member_DOB >= '01-01-1980' AND member_DOB <= '12-31-1980';
    order by name


    i dont know why this doesnt work is it because of the way we've set up the database


    CREATE TABLE MEMBER
    (MEMBER_ID VARCHAR2(9),
    MEMBER_FNAME VARCHAR2(12),
    MEMBER_LNAME VARCHAR2(12),
    MEMBER_DOB VARCHAR2(12),
    MEMBER_CITY VARCHAR2(11));


    INSERT INTO MEMBER VALUES
    ('M1', 'ADAM', 'sarah', TO_DATE('17-DEC-1980'), 'Birmingham');



    List the total number of members who live in each city. The names of the cities should appear in alphabetical order.


    im totaly stuck on this one, do i have to use a count method?

    and finally

    List all the names of the members who do not belong to any team.

    do i have to place a null value into the tables when i insert data, for instance when someone is not a member of a team insert (null, null) and then just look for the places where team_name = null

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    member_DOB should be DATE, not VARCHAR

    yes, you need to use COUNT(*) to count, and don't forget GROUP BY

    for the last one, you need a LEFT OUTER JOIN

    this is as much information as i am willing to give you, as this is obviously a school assignment and we don't help people with school assignments except to give general suggestions -- you need to do the work yourself, and it's usually as easy as looking in the textbook
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should be posted under the general database discussion area since you say you are not using mysql.


Bookmarks

Posting Permissions

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