SQLActivity1 Taasin Jargon

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Name: Jargon Ray F.

Taasin Score:

Date: 02/23/2024

I. SQL Basic Syntax (1pt each)

Instruction: Highlight the letter of your answer.

1. What is the correct syntax for INSERT statement in SQL?

2. What is the correct syntax for UPDATE statement in SQL?

3. What is the correct syntax for DELETE statement in SQL?

4. What is the correct QueryType for INSERT Statement?

5. What is the correct QueryType for DELETE Statement?

II. Simple Queries

Instruction: Right your answer in the space provided.

1. Display all records in SG.Province


SELECT * FROM SG.Province

2. Display all Province in Region 130000000. Use table SG.Province


SELECT * FROM SG.Province WHERE Region = 130000000

3. List all Province in ascending order use Column Description in Region 040000000. Use table

SG.Province.
SELECT * FROM SG.Province WHERE Region = 040000000 ORDER BY Description ASC

4. Select TOP 100 in SG.Barangay with Code and Description column only.
SELECT TOP 100 Code, Description FROM SG.Barangay

5. List all Barangays that start in Ag use Description column with Code, Description, and Municipality

column only.
SELECT Code, Description, Municipality FROM SG.BARANGAY WHERE Description LIKE 'Ag%'
6. How many barangays are in Municipality 072216000? Use table SG.Barangay. Write SQL Query.
SELECT COUNT(Description) [TotalBarangays] FROM SG.Barangay WHERE Municipality =
072216000

7. Write a query that sums the rate of SG.Taxtype with BasedOn=5.


SELECT SUM(RATE) [TotalRate] FROM SG.TAXTYPE WHERE BasedOn = 5

8. Display the MAX Rate in SG.Taxtype with column alias Tax Rate.
SELECT MAX(RATE) [Tax Rate] FROM SG.TAXTYPE

9. Display record in DC.TransactionTypeDocAssignHDR where Trantype is APVNTR and EffectiveDate

between January 2020 and December 2020.


SELECT * FROM DC.TransactionTypeDocAssignHDR Where TranType = 'APVNTR' AND EffectiveDate
BETWEEN '2020-01-01' AND '2020-12-31'

10. Display record in AP.payReqType, use CASE STATEMENT, if the code is equal to 01, display

Purchase Order, if the code is equal to 02, display Non Purchase Order, else display None. Column

Name of the CASE STATEMENT should be Description.


SELECT *, CASE WHEN code = '01' THEN 'Purchase Order'
WHEN code = '02' THEN 'Non Purchase Order' ELSE 'None' END [Description]
FROM AP.payReqSubType

You might also like