CREATE TABLE is used to create a new table in Oracle database. Oracle classifies it as DDL (Data Definition Language).
CREATE TABLE table_name ( columnname_1 datatype [ NOT NULL ], columnname_2 datatype [ NOT NULL ], ... columnname_n datatype [ NOT NULL ] );
- Name of the table you want to create
columnname_1, columnname_2… columnname_n
- Name of the columns you want to add in the table
- Datatype of each column
- A column can be NULL or NOT NULL. By default if you don’t mention anything explicitly at the column level, the column will allow NULL values. Once you define the column as NOT NULL, it becomes mandatory to enter value in that column while inserting record.
Example of CREATE TABLE
CREATE TABLE employees ( employee_id NUMBER(10) NOT NULL, employee_name VARCHAR2(240), birthdate DATE );
Here, you have created table employees containing columns employee_id, employee_name and birthdate.
employee_id column is declared as NOT NULL which restricts you from keeping the column NULL during record insertion.
The maximum length of employee_id and employee_name you can enter is 10 and 240 respectively as mentioned in its datatypes.
I hope you like the page and find it useful. We highly appreciate comments and feedback.
Hi I am Paras.
Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at email@example.com. Again I appreciate your visit. Hope to see you again and again!