I have IT homework that is due at midnight tonight. For our assignment, we had to create a table in an SQL database off my school AFS database. I am using MobaXTerm to do this homework assignment.
I created a table name "student". I created the entire table correctly. It is correct, because my professor gave me the exact command to create it. Here are the columns in order: id, firstname, lastname, address, state, gpa, credits. I populated this table with 20 students, however I do not want to post the picture of the result on here, because it has personal info on it.
I answered the other questions correctly, however I am stuck on this question that has multiple questions in it:
- Next, write and run (issue) SQL queries that do the following. For each query, provide screenshots for the SQL query and the results within a Word document so I can grade it.
a. Show state and gpa information about students with the first name Peter (I was told to add students with the name "Peter" before I created this table).
This one is correct here is the command i used:
select state, gpa, firstname from student where lastname = 'Peter';
b. Retrieve the last names, state, and credits of all students that are NOT from AZ or FL. Order by the state.
I am struggling on this one, because I do not know how to show the table of students that are both NOT from AZ and FL.
But here is a command that worked to show if they are not from one state.
select, lastname, credits, state from student where state != 'AZ'
How am I supposed to write that student is not equal to both AZ and FL?
c. How many students live on '10 Main Street'?
select id, address from student where address='10 Main Street';
This question is correct.
d. Retrieve all sophomore student ids along with their credits that are NOT C students (see the table for definition for “sophomore” and “C” grades).
So the table shows that a sophomore has 33-64 credits. A C student has a GPA of 1.7-2.69. So what is my line of command to show these range of numbers?