AgileApps Support Wiki Pre Release

Difference between revisions of "SQL Browser"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Designer > Data > Objects > [SQL Browser]'''
'''[[File:GearIcon.png]] > Customization > Developer Resources > SQL Browser'''


The SQL Browser gives you a graphical interface that lets you enter a SQL query and view the results:
The SQL Browser gives you a graphical interface that lets you enter a SQL query and view the results:
Line 10: Line 10:
:* To run the query, press <tt>Ctrl+Enter</tt> or click the triangle-button on the right.  
:* To run the query, press <tt>Ctrl+Enter</tt> or click the triangle-button on the right.  
:: [[File:SQLBrowserGoButton.png]]
:: [[File:SQLBrowserGoButton.png]]
 
{{:Common:SQL Safety Note}}
;Considerations:
{{:SQL Syntax Considerations}}
:* SQL syntax is not case-sensitive, except for table names and field names.
:* When you double-click an Object table, backticks are (<tt>`</tt>) added around the table name in the SQL expression.
:: They're needed when the table name turns out to be in the (fairly lengthly) list of [[SQL Reserved Words]].
:: For example:
::: <tt>SELECT * FROM `ORDER`</tt>
:: Without the backticks, you get an error like this:
:::<tt>Encountered "Order" at line 1, column 15. Was expecting (...</tt>
::which means that parser found a word it recognized, but didn't find other things it expected before it got to that word.
 
''Learn more:'' [[SQL Syntax]]
''Learn more:'' [[SQL Syntax]]

Latest revision as of 01:50, 29 October 2013

GearIcon.png > Customization > Developer Resources > SQL Browser

The SQL Browser gives you a graphical interface that lets you enter a SQL query and view the results:

SQLBrowserSelect.png
How it works
  • The navigation pane on the left shows all of the Object tables in your database.
  • Clicking the arrow next to one expands the tree, showing the columns in the table
  • Double-clicking a table populates the statement pane with a default query (SELECT *) from that table.
  • To run the query, press Ctrl+Enter or click the triangle-button on the right.
SQLBrowserGoButton.png

Notepad.png

Note:
When you make a SQL query, you are not querying the platform database directly. Rather, you are querying a view of the database that is restricted by your role permissions, so the records and fields you can see using SQL are the same as those you see when using the GUI. In addition, the platform implements various safeguards to prevent SQL Injection attacks.

Considerations
  • SQL syntax is not case-sensitive, except for table names and field names.
  • Backticks are (`) are needed around any table or field name that is one of the SQL Reserved Words.
For example: SELECT * FROM `Order`
Without the backticks, you get an error like this:
Encountered "Order" at line column 15. Was expecting one of (...
That error means the parser found a word it recognized, but didn't find other things it expected before it got to that word.
  • When either a table name or a field name is reserved word, and both are used together, then backticks are needed around the combination.
For example: `Order.order_number`
  • If you do a query on different tables that have fields with the same name, you should provide column aliases for those fields. (Otherwise, a query for A.phone and B.phone identifies both sets of values as "phone". A column alias like A.phone AS A-phone makes it possible to tell which table a set of values came from.)
Learn more: column_expr

Learn more: SQL Syntax