SQL Commands: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
Line 22: Line 22:
| <pre>show tables;</pre>
| <pre>show tables;</pre>
| <pre>.tables</pre>
| <pre>.tables</pre>
|}
== CREATE USER ==
{| class="wikitable"
! || Postgres || MariaDB
|-
| on database to user
| <syntaxhighlight lang="sql">
</syntaxhighlight>
| <syntaxhighlight lang="sql">
</syntaxhighlight>
|-
| on table to user
| <syntaxhighlight lang="sql">
</syntaxhighlight>
| <syntaxhighlight lang="sql">
</syntaxhighlight>
|}
|}



Revision as of 04:28, 1 September 2025

Common Operations

Functions

Postgres MariaDB SQLite
Today

Visiting

Postgres MariaDB SQLite
List tables

show tables;
.tables

CREATE USER

Postgres MariaDB
on database to user
on table to user

GRANT

Postgres MariaDB
on database to user
on table to user

SQLite 3

TODO Command
yyyymmdd to yyyy-mm-dd
SELECT printf('%s-%s-%s',
  SUBSTR(trading_date,1,4),
  SUBSTR(trading_date,5,2),
  SUBSTR(trading_date,7,2)
) FROM short_sell WHERE trading_date='20190605';