Get the App
SLTechnology News&Howtos  ›  Database  › 

Some sql commands commonly used in oracle

Shulou Source: shulou.com Published: 2022-06-01 20:16:36 11月12日 Update

/ / check the current time of the system HH24 24-hour system MI is the correct minute

Select to_char (sysdate,'yyyy-mm-dd HH24:MI:SS') from dual

/ / HH non-24 mm case-insensitive dates are considered to be months by the MM system

Select to_char (sysdate,'yyyy-mm-dd HH:MM:SS') from dual

/ / report the system date in TIMESTAMP data type format.

Select SYSTIMESTAMP from dual

/ / query the currently logged in user

Select username from user_users

Show user

/ / View table structure (field data type)

Desc user_users

/ / query the tables owned by the current user

Select table_name from user_tables

/ / forget your password to log in

Open the cmd window and enter sqlplus / as sysdba

/ / remote connection

Gb/ruiyuan@192.168.0.210/orcl

/ / create a sequence

Create sequence sequence name

Start with start sequence

The value of each increase in increment by

Sequence name .nextval (next sequence)

Sequence name .currval (current sequence)

/ / create reply temporary table data

Create global temporary table table as another table data on commit preserve rows; (you can copy the data in the original table, which is more commonly used. )

/ / add field comments (table comments)

Comment on column tmp_xian.id is' primary key'

Comment on column tmp_xian.name is' maximum user name'

COMMENT ON TABLE TABLENAME IS 'user Table'

/ / varchar2 maximum length 4000bite char (2000bite)

/ / View the first 500 rows of data

Select * from T_PUB_DOWNLOAD_DETAIL where rownum

Tags: Data sequence user space date system maximum precision field efficiency time comment type result query login common right size password Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Redmi Microsoft Shulou Technology Linux