0% found this document useful (0 votes)
68 views

SQL Part 1 Assignment Instructions

This document provides instructions for an assignment on writing basic SQL queries using the BSU_Students_3nd_edition database. Students are asked to complete 4 multi-part SQL coding questions to retrieve information from tables in the database, such as obtaining a list of unique expected graduation dates and counting the number of students with a last name ending in "r". Correct SQL code is required along with the resulting tables to receive full points. All work must be the student's own and submitted by the assignment's deadline.

Uploaded by

Momen Sati
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

SQL Part 1 Assignment Instructions

This document provides instructions for an assignment on writing basic SQL queries using the BSU_Students_3nd_edition database. Students are asked to complete 4 multi-part SQL coding questions to retrieve information from tables in the database, such as obtaining a list of unique expected graduation dates and counting the number of students with a last name ending in "r". Correct SQL code is required along with the resulting tables to receive full points. All work must be the student's own and submitted by the assignment's deadline.

Uploaded by

Momen Sati
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment: SQL Part 1 Exploring the Select

Statement

Purpose
This assignment reviews the main concepts of relational database and helps to practice on
writing simple SQL queries.

This assignment aligns with the following module outcomes:


 Write SQL queries to extract data from a relational database  

Requirements:
We will be working with the BSU_Students_3nd_edition database in MS Access.   
Find the file and copy it onto your pc or a USB “flash” drive.  You can now use the database with
any PC that has MS Access 2007 or later; which include the PC’s in the CoB computer
lab. Double click on the data base to open Access If an error message appears about a missing
link close the message box.  [you may have to click on “enable content” when it opens]. 

Step 1: View the entity Relationship Diagram (ERD) for the tables in this database. Compare it to
the one shown on the next page to be sure you have the correct database. Paste it into a word
file, save the file and print it [landscape] be sure it is readable.  You will need this for future
exercises. 

1
1. (2 points) Looking at the ERD 
a. What is the primary key of the BSU_Class table? ClassID
b. What is the primary key of the BSU_Major table? MajorID
c. What is the primary key of the BSU_StudentSchedule? ClassID, StudentID
d. What foreign key(s) are in the BSU_Students table? StudentID

2. (3 points) In Structured Query Language (SQL) the select statement is used to extract
data from a table or tables.  The statement has six clauses.  Complete the description
below: 
a. Select (Which columns of Data to get, use* to select all columns)
b. From (Which Table has the data) 
c. Where (Which rows of data to get)
d. Group by summarizes rows based upon membership in a group, e.g., dept. 
e. Having used with “group by” clause to further filter results, e.g., < 10 employees 
f. Order by (what column are used to sort the results)

2
3. (15 points) For the following questions, please copy and paste your queries. Run it in the
Access first to check if the query is written properly. Then copy and paste your results. 

To create a query:  

Select the “Create” tab, click “Query Design”. Close the pop-up box listing tables and
select “SQL view”. 
a. (3 points) Write and run the SQL to list the different expected graduation
dates [class of 20XX] in the BSU_Students table. List each expected graduation
date only once.   
i. Paste the SQL code here:  

SELECT StuExpectedGradDate
FROM BSU_Students
Group by StuExpectedGradDate;

ii. Paste the resulting table here

  

b. (4 points) Write a single SQL query using the BSU_Students table that will return


a table, which shows the average SAT math scores and exclude the students
whose major information is missing 

i. Paste the SQL code here:  

SELECT AVG(StuSATMath) AS 'Average SAT Math Scores'


FROM BSU_Students
WHERE StuMajorID IS NOT NULL;

ii. Paste the resulting table here  

3
c. (4 points) Write a single SQL query using the BSU_StudentSchedule table that
will return a table, which shows students that have completed course
Acct23020. Sort the table by student id and semester. 
i. Paste the SQL code here:  

SELECT *
FROM BSU_StudentSchedule
WHERE course = 'Acct23020'
ORDER BY student_id, semester;

ii. Paste the resulting table here  

d. (4 points) Count the number of students in the  BSU_Students table with a last


name ending in “r”,  

4
i. Paste the SQL code here:  

SELECT COUNT(student_id)
FROM BSU_Students
WHERE last_name LIKE '%r' ;

ii. Paste the resulting table here  


 

 
 

Rubrics 
For coding questions, resulting tables are required and each is worth of 1 point. Queries that do
not run will not earn any points. Queries that run but do not extract the information required
will earn 50% of points. 

General Submission Instructions:


All work must be your own. Copying other people’s work or from the Internet is a form of
plagiarism and will be prosecuted as such.

You may submit a Microsoft Word (.doc/.docx) document as an attachment using the
Assignment tool, or you may copy and paste your answer into the provided box within the
Assignment tool. If you attach a document for your assignment, be sure to include your name
in the text of the document and in the name of the document.

 You can only submit once, so make sure you are completely finished before submitting
and that you attach the correct word .doc/.docx file.
 Submissions sent by email will NOT be accepted in general, with instructor’s permission
only for unexpected contingencies.
Due dates are listed in the Assignment Schedule document.

You might also like