Skip to content

Commit

Permalink
Fix grammatical errors (#85)
Browse files Browse the repository at this point in the history
* Fix grammatical errors

* fix grammatical errors
  • Loading branch information
NoorunnisaSulthan authored Oct 16, 2023
1 parent 242f301 commit 1ef9289
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions ebook/en/content/000-introduction.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# About the book

* **This version was published on October 13 2021**
* **This version was published on October 13,2021**

This is an open-source introduction to SQL guide that will help you learn the basics of SQL and start using relational databases for your SysOps, DevOps, and Dev projects. No matter if you are a DevOps/SysOps engineer, developer, or just a Linux enthusiast, you will most likely have to use SQL at some point in your career.
This open-source introduction to SQL guide will help you learn the basics of SQL and start using relational databases for your SysOps, DevOps, and Dev projects. Whether you are a DevOps/SysOps engineer, developer, or just a Linux enthusiast, you will most likely have to use SQL at some point in your career.

The guide is suitable for anyone working as a developer, system administrator, or a DevOps engineer and wants to learn the basics of SQL.
The guide is suitable for anyone working as a developer, system administrator, or DevOps engineer who wants to learn the basics of SQL.

## About the author

Expand Down
16 changes: 8 additions & 8 deletions ebook/en/content/007-order-and-group-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

In the last chapter, you've learned how to use the `SELECT` statement with the `WHERE` clause and filter the result set based on some conditions.

More often than not, you would want to order the results in a specific way based on a particular column. For example, you might want to order the users alphabetically, based on their username.
More often than not, you would want to order the results in a specific way based on a particular column. For example, you might want to order the users alphabetically based on their username.

In this chapter, you will learn how to use the `ORDER BY` and `GROUP BY` clauses.

## ORDER BY

The main thing that you need to keep in mind when using `ORDER BY` is to specify the column or columns you want to order by. In case that you want to specify multiple columns to order by, you need to separate each column with a comma.
The main thing that you need to keep in mind when using `ORDER BY` is to specify the column or columns you want to order by. In case you want to specify multiple columns to order by, you need to separate each column with a comma.

If we were to run the following statement without providing an `ORDER BY` clause:

Expand All @@ -31,7 +31,7 @@ We will get the following output:
+----+----------+
```

As you can see, the result set is sorted by the primary key, which in our case is the `id` of each user. If we wanted to sort the output by `username`, we would run the following query:
As you can see, the result set is sorted by the primary key, which, in our case, is each user's id. If we wanted to sort the output by `username`, we would run the following query:

```sql
SELECT id, username FROM users ORDER BY username;
Expand All @@ -54,7 +54,7 @@ The output, in this case, will be:
+----+----------+
```

> Note: You can use `ORDER BY` with and without specifying a `WHERE` clause. If you've used a `WHERE` clause, you need to put the `ORDER BY` clause after the `WHERE` clause.
> Note: You can use `ORDER BY` with and without specifying a `WHERE` clause. If you've used a `WHERE` clause, you must put the `ORDER BY` clause after the `WHERE` clause.
The default sorting is ascending and is specified with the `ASC` keyword, and you don't need to add it explicitly, but if you want to sort by descending order, you need to use the `DESC` keyword.

Expand Down Expand Up @@ -86,9 +86,9 @@ As you can see, we've got the same list of users sorted alphabetically but in re

The `GROUP BY` statement allows you to use a function like `COUNT`, `MIN`, `MAX` etc., with multiple columns.

For example, let's say that we wanted to get all of the counts of all users grouped by username.
For example, let's say that we wanted to get all user counts grouped by username.

In our case, we have two users with username `bobby`, two users with username `tony`, and two users with username `devdojo`. This represented in an SQL statement would look like this:
In our case, we have two users with the username `bobby`, two users with the username `tony`, and two users with the username `devdojo`. This represented in an SQL statement would look like this:

```sql
SELECT COUNT(username), username FROM users GROUP BY username;
Expand Down Expand Up @@ -116,7 +116,7 @@ The `HAVING` clause allows you to filter out the results on the groups formed by

For example, let's say that we wanted to get all usernames that are duplicates, i.e., all the usernames present in more than one table record.

In our case, we have two users with username `bobby`, two users with username `tony`, and two users with username `devdojo`. This represented in an SQL statement would look like this:
In our case, we have two users with the username `bobby`, two users with the username `tony`, and two users with username `devdojo`. This represented in an SQL statement would look like this:

```sql
SELECT COUNT(username), username
Expand All @@ -139,5 +139,5 @@ The output, in this case, would be:

The `GROUP BY` clause grouped the identical usernames, calculated their counts and filtered out the groups using the `HAVING` clause.

> **NOTE** :- _The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause._
> **NOTE**:- _The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause._

0 comments on commit 1ef9289

Please sign in to comment.