A database interrogation is a major benefit of the database management approach,
ID: 3604231 • 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
(a)
SELECT[STUDENT _ID], [STUDENT_GPA]
FROM [STUDENTS]
WHERE [COURSE_ID]="IT101"AND[COLLEGE_CODE]="CCI".
RESULT
STUDENT_ID COURSE_ID COLLEGE_CODE 140064001 IT101 CHS 140064003 IT242 CCI 140064004 IT446 CCI 140064007 IT242 CCI