database concepts

Using a database: What is a db?

Simple query: SELECT Statement

The simplest form of the SELECT query is:
     SELECT columnlist
     FROM tablename;

For example to retrieve the ItemDesc and ItemPrice for each Item:
     SELECT ItemDesc, ItemPrice
     FROM Item;

Remember

At the end of all SQL statements is a ; without this semi-colon the statement will not run.

When run in Oracle this query will produce the following output:

Table

To retrieve all columns in a table * is used.

For example:
         SELECT *
       FROM Customer;

This query retrieves all the data in the Customer table:

Output

The output is quite hard to read as the columns wrap over a line and the headings for the state and postcode fields are chopped off. So while this output is awkward to read, it is important to recognise the function of the tool. It is merely a simple interface to the database for IT Professionals. End users of the database would not see this interface. Instead a professional, easy to use interface would be developed possibly using the Forms Developer and Oracle Reports tools provided by Oracle.

Remember

So don’t worry about the appearance of this output!