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

Name: Jeffrey P Tilad JR Date: Section: Bsis Score: Week: 7

The document contains 4 SQL queries and their results on sample student and course tables. Query 1 selects students enrolled in the BSIS course. Query 2 selects students with monthly allowances above the minimum, adding the minimum to their allowance amount. Query 3 selects students in the BPA course, adding the total of all monthly allowances to their allowance. Query 4 selects students enrolled in the BSIS, BSCRIM or BPA courses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Name: Jeffrey P Tilad JR Date: Section: Bsis Score: Week: 7

The document contains 4 SQL queries and their results on sample student and course tables. Query 1 selects students enrolled in the BSIS course. Query 2 selects students with monthly allowances above the minimum, adding the minimum to their allowance amount. Query 3 selects students in the BPA course, adding the total of all monthly allowances to their allowance. Query 4 selects students enrolled in the BSIS, BSCRIM or BPA courses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: Jeffrey P Tilad Jr Date:

Section: BSIS Score:


Week: 7

IV. TEST YOURSELF

Table Student

StudID LName FName Sex MonthlyAllowance CourseID

S1 John White M 3000 C1

S2 Ann Beech F 5000 C2

S3 David Ford M 2000 C3

S4 Mary Howe F 1000 C1

S5 Susan Brand F 1500 C2

S6 Julie Lee F 4000 C3

Table Course

CourseID CourseName

C1 BSIS

C2 BSCRIM

C3 BPA

C4 BSE

Write the result table of the following SQL queries using Student and Course table

above.

1. Select * From Student where CourseID= (Select CourseID From Course where
CourseName=’BSIS’).

ANSWER:
StudID LName FName Sex MonthlyAllowanc CourseID
e
S1 John White M 3000 C1
S4 Mary Howe F 1000 C1

2. Select StudID, LName, FName, Sex, MonthlyAllowance+ (Select MIN


(MonthlyAllowance) From Student) FROM Student where MonthlyAllowance >
(Select MIN (MonthlyAllowance) From Student).

ANSWER:

StudID LName FName Sex MonthlyAllowance

S1 John White M 4000


S2 Ann Beech F 6000
S3 David Ford M 3000
S5 Susan Brand F 2500
S6 Julie Lee F 5000

3. Select StudID, LName, FName, Sex, MonthlyAllowance+(Select


SUM(MonthlyAllowance ) From Student) FROM Student where CourseID=(Select
CourseID From Course where CourseName=’BPA’).

ANSWER:

StudID LName FName Sex MonthlyAllowance


S3 David Ford M 18500
S6 Julie Lee F 20500

4. Select * From Student where CourseID IN (Select CourseID From Course where
CourseID IN (Select CourseID From Course where CourseName IN
(‘BSIS’,’BSCRIM’,’BPA’))).

ANSWER:

StudID LName FName Sex MonthlyAllowance CourseID

S1 John White M 3000 C1

S2 Ann Beech F 5000 C2

S3 David Ford M 2000 C3

S4 Mary Howe F 1000 C1

S5 Susan Brand F 1500 C2


S6 Julie Lee F 4000 C3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy