HPlogo Getting Started with HP IMAGE/SQL: HP 3000 MPE/ iX Computer Systems > Chapter 2 Basic Concepts

How Do I Access a Database through SQL?

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

You use the SQL CONNECT statement to establish a connection to a DBEnvironment. This statement must be executed by some type of SQL program, such as:

  • ISQL

  • Application programs you create yourself

  • Third-party applications

  • Existing programs

During database access, you perform queries or other operations that manipulate data by inserting, deleting, or modifying rows in tables. This process is called data manipulation. Here is a simple query using the SELECT statement, which displays a selection of data from the Employees table. The asterisk indicates all columns are to be displayed:

 

     SELECT * FROM Employees;

Below is the query result:

   

   select * from employees;

   --------------+-----------+-----------

   LASTNAME      |FIRSTNAME  |EMPNUMBER

   --------------+-----------+-----------

   Harrison      |Gerald     |    2432099

   Abelson       |Annette    |    3510044

   Stanley       |Peter      |    3540011

   Walters       |Georgia    |    9124772

The query result is also known as a result table.

Other data manipulation statements include the SQL INSERT, UPDATE, and DELETE statements. These let you add rows to a table, update specific column values in existing rows, or delete rows. Examples of data manipulation are shown in Chapter 6, "Practicing with IMAGE/SQL Using the MusicDBE."

Feedback to webmaster