Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A database interrogation is a major benefit of the database management approach,

ID: 3602472 • Letter: A

Question

A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database for information. The Structured Query Language (SQL) is an international standard query language found in many DBMS packages. The basic form of a SQL query is: SELECT . . . FROM . . . WHERE .

For example, if we have the following STUDENTS table:

STUDENT_ID

STUDENT_NAME

COURSE_ID

STUDENT_GPA

COLLEGE_CODE

140064001

Ahmad Nasser

IT101

3.5

CHS

140064002

Sarah Abdullah

IT343

2.75

CCI

140064003

Sultan Mohamed

IT242

3.15

CCI

140064004

Basmah Khaled

IT446

3.90

CCI

140064005

Bader Ali

IT101

2.90

CHI

140064006

Fahad Mutlaq

IT448

1.95

CCI

140064007

Salman Abdulaziz

IT242

2.90

CCI

The following SQL query is used to retrieve STUDENT_NAME and COURSE_ID for all students who have GPA = 2.90

SELECT [STUDENT_NAME], [COURSE_ID]

FROM [STUDENTS]

WHERE [STUDENT_GPA] = 2.90

And the result of the above query is:

STUDENT_NAME

COURSE_ID

Bader Ali

IT101

Salman Abdulaziz

IT242

Based on the above STUDENTS table, answer the following questions:

Write an SQL query to retrieve STUDENT_ID and STUDENT_GPA for all CCI students who study the course has the code IT101.

What is the result of the following query?

SELECT [STUDENT_ID], [COURSE_ID], [COLLEGE_CODE]

FROM [STUDENTS]

WHERE [COURSE_ID] = “IT242” OR [STUDENT_GPA] > 3.00

STUDENT_ID

STUDENT_NAME

COURSE_ID

STUDENT_GPA

COLLEGE_CODE

140064001

Ahmad Nasser

IT101

3.5

CHS

140064002

Sarah Abdullah

IT343

2.75

CCI

140064003

Sultan Mohamed

IT242

3.15

CCI

140064004

Basmah Khaled

IT446

3.90

CCI

140064005

Bader Ali

IT101

2.90

CHI

140064006

Fahad Mutlaq

IT448

1.95

CCI

140064007

Salman Abdulaziz

IT242

2.90

CCI

Explanation / Answer

Hi,
1.
To get names and GPA of students with college code CCI and course Id IT101, we need to use the AND clause withing the where like below,

SELECT [STUDENT_NAME], [STUDENT_GPA]

FROM [STUDENTS]

WHERE [COLLEGE_CODE] = 'CCI' AND  [COURSE_ID] = 'IT101'

2.

SELECT [STUDENT_ID], [COURSE_ID], [COLLEGE_CODE]

FROM [STUDENTS]

WHERE [COURSE_ID] = “IT242” OR [STUDENT_GPA] > 3.00
this will give us all students with their id, course id and college code who belong to course 1T242 OR have gpa>3 i.e it will return
140064001 IT101 CHS
140064003 IT242 CCI
140064004 IT446 CCI
140064007 IT242 CCI

Thumbs up if this was helpful, otherwise let me know in comments