Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document queries and joins in YSQL - Doc6849 #7173

Merged
merged 14 commits into from
Feb 16, 2021

Conversation

lizayugabyte
Copy link
Contributor

No description provided.

@lizayugabyte lizayugabyte changed the title Doc6849 Document queries and joins in YSQL - Doc6849 Feb 9, 2021
@lizayugabyte lizayugabyte linked an issue Feb 9, 2021 that may be closed by this pull request
@lizayugabyte lizayugabyte self-assigned this Feb 9, 2021
@lizayugabyte
Copy link
Contributor Author

The doc on queries and joins (for the Explorer section of Yugabyte docs) is ready for review.

@lizayugabyte lizayugabyte requested a review from m-iancu February 9, 2021 22:37
@@ -34,29 +34,28 @@ The following `SELECT` statement clauses provide flexiblity and allow you to fin
- The `DISTINCT` operator allows you to select distinct rows.
- The `ORDER BY` clause lets you sort rows.
- The `WHERE` clause allows you to apply filters to rows.
- The `LIMIT` and `FETCH` clauses allow you to select a subset of rows from a table.
- The `LIMIT` clauses allow you to select a subset of rows from a table.
Copy link
Contributor

@jaki jaki Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/clauses allow/clause allows/

Since YSQL is case-sensitive (that is, it treats the same characters differently depending on whether they are uppercase and lowercase), it is important to use correct cases when forming queries. For example, a table called `Employees` would not be recognized as an `employees` table, even if that is what you mean. That is, if your database contains an `employees` table and you want to query it using the following statement, the query execution will result in an error:

```sql
SELECT name FROM Employees;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know this section is not quite correct.
Identifiers are normalized to lowercase unless they are quoted.
So, for example:

yugabyte=# create table fOo(iD int PRIMARY KEY);
CREATE TABLE
yugabyte=# select Id from FoO; -- any capitalization works if unquoted
 id
----
(0 rows)

yugabyte=# create table "bAr"("iD" int PRIMARY KEY);
CREATE TABLE
yugabyte=# select iD from bAr; -- no capitalization works because identifiers will let lowercased if unquoted
ERROR:  relation "bar" does not exist
LINE 1: select iD from bAr;
                       ^
yugabyte=# select "iD" from "bAr"; -- quoting with the same as the declared capitalization will work.
 iD
----
(0 rows)

yugabyte=# \d
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 public | bAr  | table | yugabyte
 public | foo  | table | yugabyte
(2 rows)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this section

@lizayugabyte
Copy link
Contributor Author

This PR has been "in review" for 7 days. If there are no other comments, then I'm going to merge it today.
The doc is available at https://docs.yugabyte.com/latest/explore/ysql-language-features/queries/ -- if you notice anything that should be changed, please open a ticket, assign it to me, and set Project to "Documentation"

@lizayugabyte
Copy link
Contributor Author

Discussed with Mihnea. Decided to publish the doc and then implement review comments via a new PR.

@lizayugabyte lizayugabyte merged commit a5c9a59 into yugabyte:master Feb 16, 2021
polarweasel pushed a commit to lizayugabyte/yugabyte-db that referenced this pull request Mar 9, 2021
* Added content to queries.md

* Added content to queries.md

* edits

* edits

* Added content to queries.md and edited _index.md

* Changed section title

* Implemented Karthik's review comments

* Moved some sections; minor edits

* Implemented review comments; misc edits

* Implemented review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs/Explore] Document queries and joins in Explorer Section
3 participants