CSC455 Ch. 5 Lab 2 SQL Insert/Query (25 points)

  1. If you haven’t yet done so, change the Class and Enroll tables to use INNODB:

mysql>alter table Class engine=INNODB;

and repeat for the Enroll table.

  1. If you haven’t changed your mySql password, please change it to your domain password with the following command at the mysql> prompt:

set password = password(“new_password”);

 

  1. Download the text file which contains the data to populate the tables: UniversityDB_data.txt
  2. Open it for editing. 
  3. Change the first line to use yourdatabase;
  4. Save the file with the new extension .sql

7.    Now switch to the GUI for MySQL: http://webdev.cislabs.uncw.edu/phpMyAdmin

8.    Login using your MySQL password.

9.    Select your database at the left.

10. Go to the Import tab.  Locate your sql file and import it.  This should populate your tables with data.

11. Go to the SQL tab and enter the SQL commands to do the following queries.  Once the query is working, copy and paste the SQL into a document.  Print the queries and hand in or submit into BB.  If you want to save the query for review later, you can bookmark it at the bottom of the screen.

1.    Show all of the Faculty data sorted by department and then by rank.

2.    Show first name and last name of all students majoring in Math.

3.    Show student ids and class numbers for students earning an A in that course.

4.    Show student ids and class numbers for students earning a C or lower in that course.

5.    Find the distinct facultyIds for those who teach in H221 or H225

 

The following instance may help: