Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4b987f5

Browse files
author
Jonathan Chan
committed
Updated Assessment and README
1 parent 3a20390 commit 4b987f5

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

‎Assessment.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Navigate to [W3 School's Database](https://www.w3schools.com/sql/trysql.asp?file
4646
1. Query the names and phone numbers across all Shippers and Suppliers
4747
2. Query the fullnames of all customer and employee with the letter "a" is in their First or Last Name (be careful for case sensitivity)
4848

49-
## Case Examples
49+
## Case Statements
5050

5151
1. Query all Products details and return new calculated field, PriceRange with the following conditions
5252
1. If the product price is below or equal to 15, return "Low"

‎README.md‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
11. [Joining Tables](#Joining-Tables)
1818
12. [Advanced Joins](#Advanced-Joins)
1919
13. [Combining Queries](#Combining-Queries)
20+
14. [Case Statement](#Case-Statement)
2021

2122
### Resources:
2223

@@ -692,7 +693,7 @@ WHERE p.SupplierID = s.SupplierID
692693

693694
#### Example:
694695

695-
- The below SQL Statement returns all countries of the Suppliers and Customers within a single query result set.
696+
- The below SQL Statement returns all unique countries from the Suppliers and Customers table within a single query result set.
696697

697698
```sql
698699
SELECT Country FROM Suppliers
@@ -715,4 +716,25 @@ SELECT Country FROM Customers
715716

716717
---
717718

719+
## Case Statement
720+
721+
- The CASE statement goes through conditions and returns a value when the first condition is met (like an IF-THEN-ELSE statement)
722+
- Once a condition is true, it will stop reading and return the result.
723+
- If no conditions are true, it returns the value in the ELSE clause.
724+
725+
#### Example:
726+
727+
- The below SQL statement returns a value of YES if the order quantity is greater than 40. If not, a value of NO is returned under the calculated field, QuantityOver40
728+
729+
```sql
730+
SELECT OrderID,
731+
CASE
732+
WHEN Quantity > 40 THEN "YES"
733+
ELSE "NO"
734+
END as QuantityOver40
735+
FROM OrderDetails
736+
```
737+
738+
---
739+
718740
> You have reached the end of the SQL quick start guide!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /