Home » Oracle Database » Create Table with Tablespace in Oracle

Create Table with Tablespace in Oracle

The following example shows how to create a table with the tablespace clause in Oracle.

Create Table with Tablespace Example

If you create a table in Oracle without the tablespace keyword then it creates that table in the user tablespace by default. So if you want to create a table in a different tablespace then you will have to specify the tablespace name. Below is an example:

Create Table Student (
  student_id number primary key,
  student_name varchar2(100),
  roll_no number
) Tablespace student_data;

Now the table student will be created in the student_data tablespace. But make sure the student_data tablespace must exist. If not, then you can create the tablespace as follows:

CREATE TABLESPACE student_data
   DATAFILE 'st1.dbf'
   SIZE 10m
   AUTOEXTEND 10m;

Useful Resources

Oracle Create Table Document

Video Tutorial