EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Oracle Tutorial Oracle Column
Secondary Sidebar
Oracle Tutorial
  • Advanced
    • Timestamp to Date in Oracle
    • Oracle Golden Gate
    • Oracle Virtual Machine
    • Oracle Describe Table
    • Oracle Clauses
    • Oracle Having Clause
    • Oracle?Primavera
    • Oracle FOREIGN Key
    • PIVOT in Oracle
    • Oracle Alter Table
    • Oracle Queries
    • Oracle Views
    • Oracle Window Functions
    • Oracle String Functions
    • Oracle Date Functions
    • Oracle Analytic Functions
    • Oracle Aggregate Functions
    • Select in Oracle
    • INSERT in Oracle
    • DISTINCT in Oracle
    • Function in Oracle
    • Oracle GROUP_CONCAT
    • Oracle INSTR()
    • Oracle CONVERT
    • Oracle LENGTH()
    • Oracle EXISTS
    • Oracle REPLACE()
    • Oracle MERGE
    • Oracle LEAD()
    • Oracle EXTRACT()
    • Oracle LISTAGG()
    • Oracle SYS_CONTEXT()
    • Oracle COALESCE
    • Oracle NVL()
    • Oracle SYSDATE()
    • Oracle?Date Format
    • Oracle SYS_GUID()
    • Oracle WILDCARDS
    • Oracle Synonyms
    • Oracle Subquery
    • BETWEEN in Oracle
    • FETCH in Oracle
    • Oracle Index
    • Oracle Function-based Index
    • Oracle UNIQUE Index
    • Oracle Bitmap Index
    • Oracle Column
    • Oracle Triggers
    • Oracle Procedures
    • Sample Database for Oracle
    • Oracle LIKE Operator
    • ORDER BY in Oracle
    • Oracle ORDER BY DESC
    • GROUP BY in Oracle
    • Oracle GROUP BY HAVING
    • Oracle Aliases
    • Table in Oracle
    • Oracle Temporary Table
    • Oracle? Table Partition
    • Oracle rename table
    • Oracle CTE
    • Cursor in Oracle
    • Oracle LOCK TABLE
    • Oracle Tablespace
    • Oracle CARDINALITY
    • Oracle REGEXP
    • Oracle REGEXP_REPLACE
    • Oracle to_date
    • JSON in Oracle
    • Oracle COMMIT
    • Oracle GRANT
    • Oracle MD5
    • Oracle ROLLBACK
    • Oracle Users
    • Oracle TIMESTAMP
    • IF THEN ELSE in Oracle
    • Oracle While Loop
    • Oracle Clone Database
    • Oracle Backup Database
    • Oracle? XML
    • Oracle XMLAGG
    • Oracle XMLTABLE
    • Oracle Performance Tuning
    • Oracle B Tree Index
    • Oracle fusion
    • Oracle ebs
    • Oracle GRC
    • Oracle ERP
    • Oracle ASM
    • Oracle Cloud
    • Oracle HCM Cloud
    • Oracle Integration Cloud
    • Oracle Jinitiator
    • Oracle pathfinder
    • Oracle VirtualBox
    • Oracle Weblogic Server
    • Oracle decode
    • Oracle Exadata
    • Oracle ZFS
    • Oracle? utilities
    • JDBC Driver for Oracle
    • Oracle? DBA Versions
    • Oracle DBA Salary
  • Basic
    • Oracle Marketing Cloud
    • What is Oracle?
    • Career in Oracle
    • How to Install Oracle
    • Oracle Versions
    • What Is Oracle Database
    • Oracle Data Warehousing
    • Oracle Warehouse Builder
    • Career In Oracle Database Administrator
    • Career In Oracle DBA
    • What is Oracle RAC
    • Oracle DBA
    • Oracle? Vanderbilt
    • What is RMAN Oracle
    • Oracle Database Administration
    • Oracle Operators
    • Oracle Constraints
    • Oracle number
    • Oracle Data Types
    • Oracle UNIQUE Constraint
    • Oracle Check Constraint
  • Joins
    • Joins in Oracle
    • Inner Join in Oracle
    • Oracle Cross Join
    • Left Join in Oracle
    • OUTER Join in Oracle
    • Oracle Full Outer Join
    • Natural Join in Oracle
    • Oracle Self Join
    • Oracle hash join
    • Oracle? Update with Join
  • Oracle SET Operators
    • UNION in Oracle
    • Oracle UNION ALL
    • INTERSECT in Oracle
    • MINUS in Oracle
  • Interview Questions
    • Oracle Interview Questions
    • Oracle Apps Interview Questions
    • Oracle Apps Technical Interview Questions
    • Oracle Database Interview Questions
    • Oracle Forms Interview Questions
    • Oracle PL/SQL Interview Questions
    • Oracle RAC Interview Questions
    • Oracle SOA Interview Questions

Related Courses

Oracle Course Training

Oracle DBA Certification Course

MongoDB Certification Training

Oracle Column

By Priya PedamkarPriya Pedamkar

Oracle Column

Introduction to Oracle Column

A column in Oracle can be defined as a set of data values which is only of a particular type and is homogenous containing values which can be integer, character, string, images, BLOB and many more and each value in the column represents one value for each row of the oracle database and a table in the oracle database or any other relational database (where data is stored in tabular form) is formed by the columns and rows.

Examples to Implement Oracle Column

Let us now understand a little better with the help of an example:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,992 ratings)

Example #1: Add a Column in Oracle

In the first point, we will discuss how to add a column in Oracle. ALTER statement is a DDL statement as we are going to change the structure of the table by adding a column.

Code:

ALTER TABLE customers
ADD frequency NUMBER(3);

Output:

DDL statement

Explanation: In this query frequency column of data type NUMBER is being added to the existing table customers. Let us now execute the query in SQL developer and check the result. As we can see in the screenshot the table customers have been successfully altered.

Example #2: Adding Multiple Columns in a Table

In this case, we are going to add more than one column in a table. For this example, we are going to add two columns to the table customers. Let us look at the query for the same.

Code:

ALTER TABLE customers
ADD (frequency NUMBER(3), DOB date);

Output:

Adding Multiple Columns

Explanation: In the query above we are adding the columns frequency and DOB to table customers. Let us execute the query in SQL developer and check the result. As we can see in the screenshot the two columns have been successfully added.

Example #3: Alter Statement to Add Constraint to a Column

In the previous point, we discussed how to add single or multiple columns in a table. So, just as we can add a new column to an existing table, similarly we can also use ALTER statement to modify an existing column in a table and add a new constraint to that specific column. Since the column is already present. So, we will modify the column and ADD a new constraint to it.

Let us go through an example to understand it better. In this example, we are going to add a constraint UNIQUE to one of the existing columns in the table customers already present in the database. Let us prepare the query for the same.

Code:

ALTER TABLE customers
MODIFY customer_name UNIQUE;

Output:

Alter Statement

Explanation: The column is customer_name and we are adding the NOT NULL constraint which will not allow the column to accept duplicate values. As we can see in the screenshot the table has been successfully altered.

Example #4: Rename a Column

RENAME A COLUMN: Just like we can add a new column or modify an existing column in an Oracle database. We can also RENAME the existing columns. We need to use the ALTER statement in order to achieve that milestone. In this example, we will RENAME an existing column to a different or new name. We will try to change the name of the column ‘PLACE’ present in the table ‘CUSTOMERS’ to a different new name. Let us try to prepare the query for the same.

Code:

ALTER TABLE customers
RENAME COLUMN place TO city;

Output:

Rename a Column

Explanation: In the above query the column ‘place’ is being renamed to ’city’. Let us execute the query in SQL developer and check the result. As we can see in the screenshot the column has been successfully renamed.

Example #5: Drop a Column

Just like we can add, modify, and rename an existing column. We can also DROP an existing column from the database. In this example, we are going to drop the column frequency present in the table customers. Let us prepare the query for the same.

Code:

ALTER TABLE customers
DROP COLUMN frequency;

Output:

Drop a Column

Explanation: In the above screenshot, we can see that the column has been successfully dropped and the table has been altered.

Conclusion

In this article we discussed the definition of the column in a database and then we moved on to the various types of operations we can perform on columns. In order to have a better understanding, we went through the syntaxes and examples for each operation.

Recommended Articles

This is a guide to Oracle Column. Here we discuss an introduction to Oracle Column with respective query examples for better understanding. You can also go through our other related articles to learn more –

  1. Oracle CTE
  2. Oracle REPLACE()
  3. Oracle Temporary Table
  4. Oracle EXTRACT()
Popular Course in this category
Oracle Training (14 Courses, 8+ Projects)
  14 Online Courses |  8 Hands-on Projects |  120+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Oracle DBA Database Management System Training (2 Courses)4.9
All in One Financial Analyst Bundle- 250+ Courses, 40+ Projects4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more