Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section is not intended to be a course in the SQL language. Hence, the focus will be put on the minimal set of differences that you must know in order to write queries properly.

Show tables and columns

  • show tables

  • show columns from <table>

Expand
titleExample

Code Block
languagesql
show tables

Run the statement above to list all the tables available in the database model

Image Added

And

Code Block
languagesql
show columns from <table>

to display the column and their metadata of a given table:

Image Added

Strings vs aliases

Like in the rest of the database implementations a string is enclosed between single quotes.

...

Expand
titleExample
Code Block
languagesql
SELECT
 'This is a string' as `Column Alias` 
 FROM 
  DUAL `Table alias`

Show tables and columns

Run

Code Block
languagesql
show tables

to list all the tables available in the database model

...

Code Block
languagesql
show columns from <table>

to display the column and their metadata of a given table:

...

Table, column and function names are case sensitive (Uppercase)

...

Code Block
languagesql
select * from PROJECT

will work.

Whereas

Code Block
languagesql
select * from project

will not.

...

No schema names

Many database vendors group their tables into schemas (i.e.: PUBLIC). SQL Cloud does not support them.

...

Code Block
languagesql
SELECT `i`.`KEY`as `Issue`, count(*) as `Num. comments`
FROM ISSUE `i`
LEFT JOIN ISSUECOMMENT `ic` ON `ic`.`ISSUEID` = `i`.`ID`
WHERE `i`.`JQL` = 'PROJECT = TALH'
GROUP BY `i`.`KEY`
HAVING count(*) > 2

Works!

In this query the condition has been modified to uses column aliases: `Num. comments` > 2

Code Block
SELECT `i`.`KEY`as `Issue`, count(*) as `Num. comments`
FROM ISSUE `i`
LEFT JOIN ISSUECOMMENT `ic` ON `ic`.`ISSUEID` = `i`.`ID`
WHERE `i`.`JQL` = 'PROJECT = TALH'
GROUP BY `i`.`KEY`
HAVING `Num. comments` > 2

Not works!