This is the SQL from the database name MyFirstDB and table. Included is the Student Table With the first five Fields (SID, LastName, FirstName, Score, Grade)

library(DBI)
library(odbc)
library(RODBC)

#dbconnection <- odbcConnect("SQL")
#sqlQuery(dbconnection, "use MyFirstDB")
#sqlQuery(dbconnection, "select *from ruspini")

db    <- odbcConnect("SQL")
#sql   <- "select * from [Your].[dbo].[tablename]"
sql <- "select * from MyFirstDB.dbo.student"
df1   <- sqlQuery(db, sql)
df1
## [1] student_id Last_name  First_name Score      Grade     
## <0 rows> (or 0-length row.names)

This is the SQL from the database name MyFirstDB and table. Included is the Student Table that had five fields previously but now has seven (SID, LastName, FirstName, Score, Grade, Inference, Prob) with records included. However for this particular search I purposely searched for only the first five columns, I did not include all seven.

library(DBI)
library(odbc)
library(RODBC)

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
 sqlQuery(dbconnection, "Select student_id, Last_name, First_name, Score, Grade from student2")
##    student_id Last_name First_name Score Grade
## 1           1  Lawrence     Johnny    71     3
## 2           2    Bucket    Charlie    98     2
## 3           2  Lebowski       Dude    55     2
## 4           4  Martigun        Mad    91     3
## 5           5   Granger    Hermine   100     4
## 6           6    Laurso     Daniel    86     4
## 7           7  McDonald     Ronald    55     1
## 8           8  Reynolds    Deandra    60     2
## 9           9     Benes     Elaine    99     4
## 10         10  Reynolds     Dennis    62     4

This is the SQL from the database name MyFirstDB and table. This includes all 7 columns with the final two as Inference and Prob. All of the students with a percentage score of 90 or above are displayed.

library(DBI)
library(odbc)
library(RODBC)

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
sqlQuery(dbconnection, "select * from student2 where Score > 90")
##   student_id Last_name First_name Score Grade           Inference Prob
## 1          2    Bucket    Charlie    98     2 Get into University  0.5
## 2          4  Martigun        Mad    91     3 Get into University  0.5
## 3          5   Granger    Hermine   100     4 Get into University  1.0
## 4          9     Benes     Elaine    99     4 Get into University  1.0

This is the SQL from the database name MyFirstDB and table. This has additional records added to the original and displays the probability of these students getting into University by combining their grade percentages along with their GPA’s. When the results are displayed the students have three choices, they have either 1.0, 0.5, or 0.0 percent of getting accepted to University. The 1.0 number will guarantee the students a 100% probability of acceptance into the University, the 0.5 gives them a 50% probability of being accepted, and the 0.0 gives the students 0% probability of being accepted. This first display shows all students with a Score of 90 or above and a GPA score of 3.0 and above

library(DBI)
library(odbc)
library(RODBC)

#sql <- "select * from MyFirstDB.dbo.student2"
#df1   <- sqlQuery(db, sql)
#df1

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
sqlQuery(dbconnection, "select Last_name, First_name, Inference, Prob from student2 where Score > 90 and Grade > 3") 
##   Last_name First_name           Inference Prob
## 1   Granger    Hermine Get into University    1
## 2     Benes     Elaine Get into University    1

Below searches for all students that are above a 3.0 GPA and below a Score of 90 have a 50% chance of being accepted.

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
sqlQuery(dbconnection, "select Last_name, First_name, Inference, Prob from student2 where Score < 90 and Grade > 3") 
##   Last_name First_name           Inference Prob
## 1    Laurso     Daniel Get into University  0.5
## 2  Reynolds     Dennis Get into University  0.5

Below searches for all students that are below a 3.0 GPA and above a Score of 90 have a 50% change of being accepted.

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
sqlQuery(dbconnection, "select Last_name, First_name, Inference, Prob from student2 where Score > 90 and Grade < 3") 
##   Last_name First_name           Inference Prob
## 1    Bucket    Charlie Get into University  0.5

Below searches for all students that are below a 3.0 GPA and below a Score of 90 have 0 chance of being accepted.

dbconnection <- odbcConnect("SQL")
sqlQuery(dbconnection, "use MyFirstDB")
## character(0)
sqlQuery(dbconnection, "select Last_name, First_name, Inference, Prob from student2 where Score < 90 and Grade < 3") 
##   Last_name First_name           Inference Prob
## 1  Lebowski       Dude  Get into Univesity    0
## 2  McDonald     Ronald Get into University    0
## 3  Reynolds    Deandra Get into University    0