You are here: SQL Development > Using NuoDB SQL Command Line > Using Command Line History in NuoDB SQL

Using Command Line History in NuoDB SQL

Command line history is available by invokiing the nuosqlhistory command and either the double-bang command (!!), the bang command (!), or command line editing.

Note: Command line history is supported on Linux systems only.

To view your command line history, enter the history command at the nuosql prompt. For example:

SQL> history
...
244 select * from system.querystats ;
245 show table system.querystats;
246 use system
247 show tables
248 history
249 help history
250 history
251 use user
252 drop table t if exists;
253 create table t (x int);
254 insert into t values (1),(2),(3);
255 select * from t;
256 history
SQL>

Execute Previous Command

To execute the previous command, you have two options.

  1. Type !!:
  2. SQL> select * from t;
    X 
    --
    1 
    2 
    3
    SQL> !!
    select * from t;
    X 
    --
    1 
    2 
    3
    SQL>
  3. Type CTRL-p to get to the previous command and then hit enter.

Execute Previous Command Starting With...

To execute the last command that started with the string "select":

SQL> select * from t;
X 
--
1 
2 
3
SQL> insert into t values (4);
SQL> !select
select * from t;
X 
--
1 
2 
3
4
SQL>