How to Use the Dual Table

  • google plus

In Brief...

Imagine you wanted to display the date 90 days from now using a select statement in Oracle. Your select statement would require a "from" clause that references one or more tables. But if you don't have a particular table in mind, as would be the case in this scenario, what table might you reference? The answer is the dual table that is provided for scenarios like displaying a date. The table itself is trivial, just one column and one row of data!

Take our Advanced Oracle SQL Queries course for free.

See the Course Outline and Register

Instructions

To learn how to use the dual table, follow these steps:

  1. You'll need to download and install Oracle 12c. The instructions for the setup can be found in How to use sample schemas. Follow steps 1 through 4 before proceeding to the next step.
  2. Let's try selecting the date 90 days from now using the dual table. Type in the following select statement and then hit Enter:
    Display date 90 days from now
    .
  3. You can format the date as well:
    Display formatted date 90 days from now

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, XML, Windows, Java, Adobe, HTML5, JavaScript, Angular, and much more. Check out our complete course catalog.

Categories

Courses

Author: Stephen Withrow

Stephen has over 30 years' experience in training, development, and consulting in a variety of technology areas including Java, C, C++, XML, JavaScript, AJAX, Tomcat, JBoss, Oracle, and DB2. His background includes design and implementation of business solutions on client/server, Web, and enterprise platforms. Stephen is a published writer in both technical and non-technical endeavors. Stephen received an undergraduate degree in Computer Science and Physics from Florida State University.

Discuss