Classroom Exercise:  Simple Querys


Objective:  Use a relational database management system to do simple querys
    (selectS) on a single table. For a localhost database, the table 
    definition below could be typed or retrieved from a source file
    (source pathname) or copied to the command line/window. Data 
    for inserts or the load utility may be obtained from: 
    http://faculty.tamu-commerce.edu/tombrown/data/student.csv

1.  Elementary querys(doing the relational operation "project"):
    a.  Select the column called sName from the Student table.


    b.  Select sId, sName, and major from Student.


    c.  Select all attributes from Student.


    d.  Project major from Student with duplicates removed.


    e.  List sId and sName for students in order by sName.


    f.  Retrieve student names in descending order by birthdate.


2.  Qualified Retrieval ("selection" or "restrict"):
    a.  Retrieve sName and birthdate from Student where major is equal to the 
        string 'MATH'.



    b.  Show sName and birthdate found in Student where major is 'MATH' and 
        classYear = 'Junior'.



    c.  Select sName from Student where major is 'MATH' or 'CSCI'.  Code this
        two ways: with an OR and also with the IN clause.



    d.  Query Student to find the names of students that do NOT major in 'MATH' 
        or 'CSCI'.



    e.  Make a list of student names beginning with the letter 'B'.

    
    
Student table definition:                 Load utility for csv file:
  create table student                      load data local infile 'pathname'
  (sId       decimal(3) primary key,        into table student
   sName     varchar(12),                   [fields terminated by ','];
   major     char(4),
   classYear char(8),
   birthdate date) engine=innodb;