diff --git a/src/data/question-groups/full-stack/content/code-splitting.md b/src/data/question-groups/full-stack/content/code-splitting.md index 14a4271e2..428d67cda 100644 --- a/src/data/question-groups/full-stack/content/code-splitting.md +++ b/src/data/question-groups/full-stack/content/code-splitting.md @@ -14,4 +14,5 @@ function App() { ); -} \ No newline at end of file +} +``` \ No newline at end of file diff --git a/src/data/question-groups/golang/content/string-literals.md b/src/data/question-groups/golang/content/string-literals.md index ac3745da2..22e1a89af 100644 --- a/src/data/question-groups/golang/content/string-literals.md +++ b/src/data/question-groups/golang/content/string-literals.md @@ -1,4 +1,4 @@ -Raw string literals in Go are enclosed in backticks (`` ` ``) and preserve all formatting exactly as written. This is different from interpreted string literals, which process escape sequences like \n. This distinction is particularly useful when you need to process data exactly as it is written. +Raw string literals in Go are enclosed in backticks (\`) and preserve all formatting exactly as written. This is different from interpreted string literals, which process escape sequences like \n. This distinction is particularly useful when you need to process data exactly as it is written. Consider a scenario where you need to embed an HTML template directly into your Go code. With raw string literals, you can include the HTML exactly as written without worrying about escaping characters or preserving the formatting. For example: @@ -11,7 +11,7 @@ htmlTemplate := `

Hello, World!

-` +` // backtick here ends the raw string literal ``` In this case, the raw string literal enclosed in backticks preserves newlines, tabs, and any other whitespace exactly as you write them. \ No newline at end of file diff --git a/src/data/question-groups/javascript/content/css-selectors-javascript.md b/src/data/question-groups/javascript/content/css-selectors-javascript.md index 67974e87f..fff16638d 100644 --- a/src/data/question-groups/javascript/content/css-selectors-javascript.md +++ b/src/data/question-groups/javascript/content/css-selectors-javascript.md @@ -19,4 +19,5 @@ const styleP = document.getElementById("styleP"); styleP.style.color = "red"; styleP.style.border = "3px solid black"; -console.log(styleP.style); \ No newline at end of file +console.log(styleP.style); +``` \ No newline at end of file diff --git a/src/data/question-groups/javascript/content/function-scope.md b/src/data/question-groups/javascript/content/function-scope.md index 25738e7d5..f621ec3c0 100644 --- a/src/data/question-groups/javascript/content/function-scope.md +++ b/src/data/question-groups/javascript/content/function-scope.md @@ -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 \ No newline at end of file +myStudyPlan(); // Calls the function +``` \ No newline at end of file diff --git a/src/data/question-groups/javascript/content/iife.md b/src/data/question-groups/javascript/content/iife.md index a9437765c..e3445cb91 100644 --- a/src/data/question-groups/javascript/content/iife.md +++ b/src/data/question-groups/javascript/content/iife.md @@ -13,4 +13,5 @@ Immediately invoked function expressions, or IIFEs, run as soon as they're creat console.log( "roadmap.sh helps prepare for JavaScript job interview questions" ); -})(); \ No newline at end of file +})(); +``` \ No newline at end of file diff --git a/src/data/question-groups/javascript/content/imports-exports.md b/src/data/question-groups/javascript/content/imports-exports.md index 79fb225d6..66e267a71 100644 --- a/src/data/question-groups/javascript/content/imports-exports.md +++ b/src/data/question-groups/javascript/content/imports-exports.md @@ -24,4 +24,5 @@ export function studyJs(course) { import { studyJs } from './app.js'; -console.log(studyJs("roadmap.sh")); // Read the JavaScript guide on, roadmap.sh \ No newline at end of file +console.log(studyJs("roadmap.sh")); // Read the JavaScript guide on, roadmap.sh +``` \ No newline at end of file diff --git a/src/data/question-groups/javascript/content/strict-mode.md b/src/data/question-groups/javascript/content/strict-mode.md index 0ae775ad7..22808ba1c 100644 --- a/src/data/question-groups/javascript/content/strict-mode.md +++ b/src/data/question-groups/javascript/content/strict-mode.md @@ -30,4 +30,5 @@ console.log(courseNumber ); // code won't run } -strictExample(); // ReferenceError \ No newline at end of file +strictExample(); // ReferenceError +``` \ No newline at end of file diff --git a/src/data/question-groups/sql/content/where-vs-having.md b/src/data/question-groups/sql/content/where-vs-having.md new file mode 100644 index 000000000..7cd0b68e7 --- /dev/null +++ b/src/data/question-groups/sql/content/where-vs-having.md @@ -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 | \ No newline at end of file