Basic queries which you need to know in the oracle

User Creation

In order to create a new user just run the below query

CREATE USER DemoUser

IDENTIFIED BY DemoPassword

DEFAULT TABLESPACE DemoSpace

TEMPORARY TABLESPACE temp

QUOTA 20M on DemoSpace;

The query is really self-explanatory and you can modify it as you wish.

Identified is used for creating the password.

Tablespace is basically a space on the disk only where all your objects like tables will be stored.

20M indicates the size of the space allotted to your tablespace.

The above query will refuse to run incase if there is no tablespace in the system. So you need to create the tablespace before executing the above query. Here is the query for the same. It is not a complete query. For that please consult official documentation.

Create tablespace spacename datafile ‘datafilename.dbf’ size 60m reuse extent management local

Also I was confused with the fact that how to store binary data in the oracle table. In the official help file it is written we can use varbinary and binary as the data types for storing binary data but they are not available in the express edition of the oracle. So in order to store the binary data in this edition we can use RAW type. The RAW type allow the storage of bytes of size up-to 4000 bytes.

How to know the version of oracle?
Select * from v$version where banner like ‘oracle%’

This entry was posted in Oracle. Bookmark the permalink.

Comments are closed.