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

Jseldess/basic sql commands #40

Merged
merged 5 commits into from
Feb 11, 2016
Merged

Conversation

jseldess
Copy link
Contributor

@jseldess jseldess commented Feb 5, 2016

Added select basics to Query a Table section.

You can see html version here: http://cockroach-draft-docs.s3-website-us-east-1.amazonaws.com/basic-sql-commands.html

Covers #5 and #33.

In future, will edit examples to be more specific, probably a bank scenario.

@@ -40,8 +40,8 @@ SHOW DATABASES;
+----------+
| Database |
+----------+
| db1 |
| system |
| "db1" |
Copy link
Member

Choose a reason for hiding this comment

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

Is it really the case that these show up with quotes?
If it is, then the table below needs them as well (the one with aardvarks etc)

Copy link
Contributor

Choose a reason for hiding this comment

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

This occurred with the switch to the pgwire driver. We can probably get rid of them as the formatting is up to us (currently we blindly use %q for any []byte returned).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petermattis, is this true for table names, field names, and types, as well, since all of those now show up with quotes?

root@:15432> show columns from cockroaches;
+----------------+----------+-------+---------+
|     Field      |   Type   | Null  | Default |
+----------------+----------+-------+---------+
| "country_code" | "STRING" | false | NULL    |
| "count"        | "INT"    | true  | NULL    |
| "date"         | "DATE"   | true  | NULL    |
+----------------+----------+-------+---------+
root@:15432> show tables;
+---------------+
|     Table     |
+---------------+
| "cockroaches" |
+---------------+

Copy link
Member

Choose a reason for hiding this comment

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

Please file an issue against the main repo to remove the quotes - at least from type names, column names, table names from the . String values are debatable, we can discuss in that issue. FWIW psql does not quote any of these (even when they have spaces).

@jseldess
Copy link
Contributor Author

@RaduBerinde, @petermattis: Latest commit should address your previous feedback:

  • quotes fixed
  • explanation of asc and desc sorting fixed
  • now using statements instead of commands
  • added create index and show index
  • other minor tweaks

Please let me know if you have any other thoughts.

You can see an updated html version here: http://cockroach-draft-docs.s3-website-us-east-1.amazonaws.com/basic-sql-statements.html

);
```

Table and column names must follow [these rules](identifiers.html). Also, when you don't explicitly define a `PRIMARY KEY`, CockroachDB will automatically add a `rowid` column as the primary key.
Copy link
Contributor

Choose a reason for hiding this comment

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

hidden rowid column

@petermattis
Copy link
Contributor

LGTM

jseldess pushed a commit that referenced this pull request Feb 11, 2016
Jseldess/basic sql commands
Fixes #5 
Fixes #33 
Fixes #41
@jseldess jseldess merged commit da33f89 into gh-pages Feb 11, 2016
@jseldess jseldess deleted the jseldess/basic-sql-commands branch February 11, 2016 20:13
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.

None yet

3 participants