TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Oracle

Oracle SQL SELECT Statement

Overview

We can use Oracle SQL SELECT Statement to retrieve data from one or database tables, views, etc. There are many options available for the SELECT  command.

Example – All rows and columns

To retrieve all rows and columns of a table:

SELECT * FROM table_name;

For example, to get all the rows and columns of dept table.

SELECT * FROM dept;

The * represents all columns in the table in the SQL query. In the next example, we will see how to retrieve only some columns in the table.

SELECT all rows and columns Oracle

Example – Select some columns

In this example, we will only retrieve some columns of the table. For example, we are not interested in the department locations. We are only interested in the department number and the department name of the dept table. We can specify the column names comma separated in the SELECT command.

SQL> SELECT deptno, dname FROM dept;

SELECT columns Oracle SQL

Notice that only deptno and dname columns are displayed in the query result.

Example – WHERE clause

We can use the WHERE clause in the SELECT statement to filter rows or retrieve only some rows from the table.

The following query will only retrieves rows that satisfies the condition deptno > 2000. The table has four rows, but only two rows have deptno > 2000.

SQL> SELECT * FROM dept WHERE deptno > 2000;

DEPTNO DNAME LOC
———- ——————– ——————–
3000 SALES CHICAGO
4000 OPERATIONS BOSTON

SELECT WHERE Clause Oracle SQL

—

Oracle Database Tutorials on this website:

https://www.testingdocs.com/oracle-database-tutorials-for-beginners/

More information about Oracle Database:

https://www.oracle.com/database/

Related Posts

Download SQL Developer

Oracle /

Download Oracle SQL Developer

Oracle Databse 19c Download

Oracle /

Install Oracle 19c Database On Windows 10

ORA-01109 Database Not Open

Oracle /

Fix ORA-01109: database not open Error

Oracle SQL Update Statement

Oracle /

Oracle SQL Update Statement

Oracle SQL Insert Statement

Oracle /

Oracle SQL INSERT Statement

‹ Oracle SQL CREATE TABLE Statement› Oracle SQL INSERT Statement

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version