Oracle SQL Overview

From mi-linux
Revision as of 14:54, 17 February 2016 by Cm1958 (talk | contribs) (Created page with "= SQL OVERVIEW = == Introduction == SQL is the standard language for manipulating data in a relational DBMS, becoming "the de facto standard in the relational database world...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

SQL OVERVIEW

Introduction

SQL is the standard language for manipulating data in a relational DBMS, becoming "the de facto standard in the relational database world" (Chris Date). It is English-like and non-procedural and can be used to create, query and update data, or control access to the database. It has a small number of statement types, yet is very powerful and flexible.

SQL can be used in a number of ways:

  • Interactively. Whereby the user directly types in a command to the database.
  • Embedded. Where the commands are embedded in a host language, such as C, Java or COBOL.

For the purposes of this workbook, we shall be using SQL in interactive mode.

SQL processes data a set-at-a-time, which means it works with groups of data items, e.g., the entire DEPT table. Traditional data processing usually works a record-at-a-time, which means to process more than one record, e.g., to update the salary of all lecturers in the Computing Department, the programmer would have to code loops in the program to process all records. SQL eliminates the need to write loops, making it a very powerful language.

SQL has three major components:

  • a data definition language (DDL) for defining the database structure
  • a data manipulation language (DML) for retrieving and updating data
  • a data control language (DCL) for controlling access to the data.

With some types of database management systems (DBMS), typically hierarchical and network databases, the database user would need to know a separate language for each of these components.

SQL combines all three within one language; however, we will be concentrating on the DDL and DML commands initially.

The basic structure of the SQL command is SELECT ..................................

	FROM ..................................
	WHERE .................................
  • The SELECT clause indicates the columns (attributes) to be retrieved.
  • The FROM clause indicates the tables from which the columns are to be retrieved.
  • The WHERE clause is optional and is used to specify a selection condition.