15

I want to create a table in database A from several tables in database B. I went to the PostgreSQL's documentation here to figure out how and the documentation for the command is decorated with brackets, bars, curly brackets, parenthesis, bold words and all-caps words, etc.

What do all of these symbols denote about the command and could somebody please show how I would read the documentation to determine what the correct syntax for creating a table in database A from a select query on a table in database B.

The internet has been a great resource for basic PostgreSQL formulas to copy and paste, but I'd like to move beyond copying and pasting formulas that just magically work.

4
  • 4
    { a | b } means a or b, [ stuff ] means that stuff is optional, bold is for something you have to fill in, fixed width is for literal parts of the syntax. postgresql.org/docs/current/static/notation.html Commented Sep 28, 2014 at 17:52
  • 1
    en.wikipedia.org/wiki/Syntax_diagram Commented Sep 28, 2014 at 18:13
  • CREATE TABLE ... AS SELECT ... Commented Sep 29, 2014 at 2:10
  • @muistooshort Please post as an answer? Otherwise I'd have to basically copy and paste what you said, and that gives me the twitches. Commented Sep 29, 2014 at 2:21

1 Answer 1

17

The conventions are covered in the Conventions chapter of the manual:

The following conventions are used in the synopsis of a command: brackets ([ and ]) indicate optional parts. (In the synopsis of a Tcl command, question marks (?) are used instead, as is usual in Tcl.) Braces ({ and }) and vertical lines (|) indicate that you must choose one alternative. Dots (...) mean that the preceding element can be repeated.

So { a | b } means a or b and [ stuff ] means that stuff is optional. Furthermore, bold text in an example command represents something you need to fill in and fixed-width text is a literal part of the syntax in question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.