Fix syntax issue
This commit is contained in:
1 parent
bb47e557c6
commit
4931ba060f
2 files changed
+40
-15
No files matched your search
@@ -2,21 +2,14 @@ Function scope refers to the scope of variables defined within a function. You c
|
||||
|
||||
```javascript
|
||||
function myStudyPlan() {
|
||||
var studyPlanOne = "Top JavaScript interview questions for web developers";
|
||||
let studyPlanTwo = "Top JavaScript interview questions for web developers";
|
||||
const studyPlanThree = "Top JavaScript interview questions for web developers";
|
||||
|
||||
var studyPlanOne = "Top JavaScript interview questions for web developers";
|
||||
|
||||
let studyPlanTwo = "Top JavaScript interview questions for web developers";
|
||||
|
||||
const studyPlanThree = "Top JavaScript interview questions for web developers";
|
||||
|
||||
|
||||
|
||||
console.log(studyPlanOne);
|
||||
|
||||
console.log(studyPlanTwo);
|
||||
|
||||
console.log(studyPlanThree);
|
||||
|
||||
console.log(studyPlanOne);
|
||||
console.log(studyPlanTwo);
|
||||
console.log(studyPlanThree);
|
||||
}
|
||||
|
||||
myStudyPlan(); // Calls the function
|
||||
myStudyPlan(); // Calls the function
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
You use **WHERE** for filtering rows before applying any grouping or aggregation.
|
||||
The code snippet below illustrates the use of **WHERE**. It filters the `Users` table for rows where the `Age` is greater than 18.
|
||||
|
||||
```sql
|
||||
SELECT * FROM Users
|
||||
WHERE Age > 18;
|
||||
```
|
||||
|
||||
The result of the query is similar to the table below.
|
||||
|
||||
| userId | firstName | lastName | age |
|
||||
| ------ | --------- | -------- | --- |
|
||||
| 1 | John | Doe | 30 |
|
||||
| 2 | Jane | Don | 31 |
|
||||
| 3 | Will | Liam | 25 |
|
||||
| 4 | Wade | Great | 32 |
|
||||
| 5 | Peter | Smith | 27 |
|
||||
|
||||
On the other hand, you use **HAVING** to filter groups after performing grouping and aggregation. You apply it to the result of aggregate functions, and it is mostly used with the **GROUP BY** clause.
|
||||
|
||||
```sql
|
||||
SELECT FirstName, Age FROM Users
|
||||
GROUP BY FirstName, Age
|
||||
HAVING Age > 30;
|
||||
```
|
||||
|
||||
The code above selects the `FirstName` and `Age` columns, then groups by the `FirstName` and `Age`, and finally gets entries with age greater than 30. The result of the query looks like this:
|
||||
|
||||
| firstName | age |
|
||||
| --------- | --- |
|
||||
| Wade | 32 |
|
||||
| Jane | 31 |
|
||||
Reference in new issue
Block a user