Oracle by Example brandingOracle® Cloud Running SQL Statements in Oracle Machine Learning

section 0Before You Begin

This tutorial shows you how to run SQL statements in Oracle Machine Learning. This is the fifth and final tutorial in the series Working with Oracle Machine Learning. Read the tutorials in sequence.

This tutorial takes approximately

Background

SQL or Structured Query Language is the standard language for relational database management systems. You can use SQL statements to perform tasks such as retrieving data from a database, updating data on a database, and so on. Some examples of SQL statements are SELECT, INSERT, UPDATE, DELETE, CREATE, and DROP. This OBE shows how to run a SQL statement, and uses the SELECT statement as an example.

What Do You Need?

  • Access to your Oracle Machine Learning account
  • A connection to a database interpreter

section 1Run a SQL Statement

To run a SQL statement in Oracle Machine Learning:

  1. Log in to Oracle Machine Learning using the credentials provided by your Oracle Machine Learning administrator.
  2. In the Oracle Machine Learning homepage, click Run SQL Statements. The SQL Query Scratchpad opens.
    homepage
    Description of the illustration oml_homepage_run_sql.png
  3. In the SQL Query Scratchpad, type %sql and press enter.
  4. In the next line, enter the SQL statement that you want to run. If you want to fetch data about cars, then type SELECT * FROM tablename;
    For example, to fetch all of the data about product sales from the table SALES, type the following:
    SELECT * FROM SH.SALES; where SH is the schema name, and SALES is the table name.
    scratchpad
    Description of the illustration sql_squery_scratchpad.png
  5. To run the SQL statement, click run icon or press Shift+Enter. After the statement runs successfully, Oracle Machine Learning fetches the relevant data from the database and displays it in a tabular format.
    scratchpad_with_data
    Description of the illustration sql_query_scratchpad_with_data.png
  6. If you want to visualize the data in different graphical output, then click the icons for corresponding graphical representation.
    graphics_icons
    Description of the illustration graphic_rep_data.png