To retrieve the data from Oracle database, you need to use the SQL SELECT statement. There are 3 basic steps to retrieve the data using SQL SELECT statement.

  • Choose the columns
  • Choose the rows
  • Join the tables

Below is the sample basic SQL statement using SELECT command:-

SELECT * FROM table;

SELECT and FROM are the keywords. (*) mean select all columns.

If you need to retrieve selected columns from a table, then as below:-

SELECT column1, column2, … column10 FROM table;

(column1, column2, …) is a clause for a SQL statement. If you are not sure the column names for a specific table, then you can use the DESCRIBE command to display the structure.

DESC tablename;

You need to take note few things to write a SQL statements:-

  • Not a case-sensitive.
  • Can be more than one lines.
  • Keywords cannot be abbreviated or split across lines.
  • Clauses can put in separate lines.
  • SQL statement end with semicolons (;) to terminate it before write another SQL statement. This is compulsory to use in SQL plus, and after (;) press ENTER key to run the command.

You can use the arithmetic operators (+, –, *, /) in SQL statement.

SELECT column1, column2, column3 + 100 FROM table;
SELECT column1, 50*column2+500 FROM table;

To understand a Null value:-

If a row of a column without any data, mean the value is null. Null value is not same as zero or a space, null value is mean nothing at all. Zero is a number, and a space is a character. In order to prevent the null value for that column, then we can use the ‘NOT NULL’ and ‘PRIMARY KEY’ to ensure no null value.

If you are using the arithmetic expression for the null value column, then your result is null.

To use Column Aliases:-

The purpose to use the Column Aliases in your SQL statement, is to rename a column heading to ease for understanding.

SELECT column1 AS “First Name”, column2 “Last Name”, 50*column2+500 “Monthly Profit” FROM table;

‘AS’ is an optional keyword, but if you have spaces or special characters (i.e. # or $), or need to be case-sensitive for the alias, then you need to use the double quotation marks (“ “) in your SQL statement.

To use Concatenation Operator:-

You can join the columns data value into one line result using the concatenation operator (||) in your SQL statement.

SELECT column1||column2 AS “Full Name” FROM table;

If you need to put a space between two columns as your result, then use the (‘ ‘) as below:-

SELECT column1||’ ‘||column2 AS “Full Name” FROM table;

To use Literal Character Strings:-

You need to add the number or characters or date to make it like a full sentence in your result, then you can use the single quotation mark (‘ ‘) in your SQL statement.

SELECT column1 || ‘ is the First Name of ‘ || column2 FROM table;

To use Alternative Quote (q) Operator:-

If you need to use a quote (q) in your Literal character String, then you can refer below example:-

SELECT column1 || q'[ isn’t his First Name!]‘ || column2 FROM table;

To remove the Duplicate Rows:-

When you retrieve more than one duplicate rows in your SQL SELECT statement, then you can use the DISTINCT command with your SQL SELECT statement to make sure display the unique records only.

SELECT DISTINCT column1, column2 FROM table;

Oracle Provide A Flexible RDBMS

Posted by Jasswin | 11:49 PM |

Oracle provide a flexible relational database management system (RDBMS) called Oracle Database and has below key features.

  • Store and manage data
  • Support relational structure and PL/SQL
  • Ability to store and execute program units
  • Support Java and XML
  • Optimize technique to retrieve data
  • Secure on accessing and using the database
  • Locking mechanism to protect the data in consistent way
  • Integrated, comprehensive and open methodology to manage the information

Oracle server consists of Oracle database and Oracle server instance. A system global area (SGA) will allocate the memory to share the database information to users and Oracle backend processes start running when Oracle database is started, and whole integration is called Oracle Instance.

Oracle server supports American National Standards Institute (ANSI) and International Standards Organization (ISO) standard SQL for relational database. SQL (structured query language) is the programming language used to communicate with the database server to access, control, manipulate, and define the data.

A relational database contain one or more tables, and table is the basic storage structure of an RDBMS, and usually has the primary keys and foreign keys to link the multiple tables for data consistency.

In Summary, the below SQL statements are commonly used to communicate with an RDMBS, Oracle database.

SQL Statements Remarks
SELECT
INSERT
UPDATE
DELETE
MERGE
This is called data manipulation language (DML). To use for data retrieving, put in new data, change the data value, remove the data, and sync the data.
CREATE
ALTER
RENAME
TRUNCATE
COMMENT
This is called data definition language (DDL). To setup, change, remove, and describe the data structures for the tables.
GRANT
REVOKE
This is called data control language (DCL). For administration used to control the access right for the database and structures.
COMMIT
ROLLBACK
SAVEPOINT
To be used together with DML statement to confirm or manage in group of logical transactions.

wvkctbxipg

The Oracle server has capability to support an object relational database model as below and fully integrated with the relational model.

  • Support object-oriented programming
  • Support complex data types
  • Support complex business objects

With the Oracle architecture, it support multitier application design and improve the performance and functionality for data warehouse and OLTP application. It apply to client / server based application or web-based application.

Benefits for Data warehouse:-

  • Simultaneously happen for insert, update, delete activities.
  • Database partitioning (usually by date)
  • Database archiving

Benefits for OLTP (Online Transaction Processing) Application:-

  • Real-time data sharing
  • Huge buffer cache transmitting
  • Logical constraints integration

 

Example:- Develop an Internet business application

  1. A product to store and manage the data
  2. A platform can support real-time transaction with robust engine to support complicated business logic and multi-users concurrent transactions
  3. A product can integrate to application and database level for monitoring and diagnostic purpose
  4. A product can support huge data archiving for complex reporting and matrix generation

With the Oracle Internet Platform, it includes everything that you needed for above requirements. It has the advance graphical user interface (GUI) to provide users for the development, deploying, testing, monitoring, migration, administration and many more as one.

With the Oracle Developer Suite, it provides users to develop the forms and reports through data warehouse using SQL, PL/SQL, Java to write the store procedure, functions and packages.

Oracle 10g release has three key grid-infrastructure products:-

  • Oracle Database 10g
  • Oracle Application Server 10g
  • Oracle Enterprise Manager 10g Grid Control

Oracle 10g key features:-

  • It is suitable from small business to enterprise business
  • It provide scalability, reliable, robust, and in a secure architecture
  • It has a single development model to ease the developers
  • It allow the current users with common skill set to use this platform based on SQL, PL/SQL, Java and XML
  • It provide a centralize management interface
  • It contain the grid architecture to lower the cost of computing with high quality

 

Oracle Database 10g

Oracle Database 10g is a database used to store and manager the information using SQL. In Oracle Database 10g, it is not only manage the object relational data, it even can support the unstructured data like below and does not need to be in the database (i.e. stored in file system):-

  • Multimedia format – mp3, mp4, video, graphics, and more
  • Word or PowerPoint or Spreadsheet documents
  • XML or HTML files

 

Oracle Application Server 10g

Oracle Application Service 10g is a platform for us to run the applications, even developed in J2EE. It is  a application server to cover many services that you need to use as below:-

  • Business intelligence features
  • Java platform functionality
  • Web site or web portal capability

 

Oracle Enterprise Manager 10g Grid Control 

Oracle Enterprise Manager 10g Grid Control is a UI Interface for us to manage and automate administration jobs for all the Oracle related hardware nodes or applications or databases in a grid environment. With below two key functions that simplified for IT administrators.

  • Software provisioning – With Grid Control, it automate installation, configuration, deploying, and even clone for the new set of application servers or databases if needed.
  • Application service level monitoring – With Grid Control, the administrators can monitor all as one view rather than previous method to check the servers or application or database one by one.