Structured Query Language
Using SQL, you can communicate with the Oracle server. SQL has the following advantages:
• Efficient
• Easy to learn and use
• Functionally complete (With SQL, you can define, retrieve, and manipulate data in the tables.)
Oracle’s Relational Database Management System
Oracle provides a flexible RDBMS called Oracle Database 10g. Using its features, you can store and manage data with all the advantages of a relational structure plus PL/SQL, an engine that provides you with the ability to store and execute program units. Oracle Database 10g also supports Java and XML. The Oracle server offers the options of retrieving data based on optimization techniques. It includes security features that control how a database is accessed and used. Other features include consistency and protection of data through locking mechanisms.
The Oracle10g release provides an open, comprehensive, and integrated approach to information management. An Oracle server consists of an Oracle Database and an Oracle server instance. Every time a database is started, a system global area (SGA) is allocated and Oracle background processes are started. The SGA is an area of memory that is used for database information shared by the database users. The combination of the background processes and memory buffers is called an Oracle instance.
SQL Statement*
Oracle SQL complies with industry-accepted standards. Oracle Corporation ensures future compliance with evolving standards by actively involving key personnel in SQL standards committees. Industry-accepted committees are American National Standards Institute (ANSI) and International Standards Organization (ISO). Both ANSI and ISO have accepted SQL as the standard language for relational databases.
Tables Used in the Course
The following main tables are used in this course:
• EMPLOYEES table: Gives details of all the employees
• DEPARTMENTS table: Gives details of all the departments
• JOB_GRADES table: Gives details of salaries for various grades
Note: The structure and data for all the tables are provided in Appendix B.
Relational database management systems are composed of objects or relations. They are managed by operations and governed by data integrity constraints.
Oracle Corporation produces products and services to meet your RDBMS needs. The main products are the following:
• Oracle Database 10g, with which you store and manage information by using SQL
• Oracle Application Server 10g, with which you run all of your applications
• Oracle Enterprise Manager 10g Grid Control, which you use to manage and automate administrative tasks across sets of systems in a grid environment
SQL
The Oracle server supports ANSI-standard SQL and contains extensions. SQL is the language that is used to communicate with the server to access, manipulate, and control data.
Basic SELECT Statement
In its simplest form, a SELECT statement must include the following:
• A SELECT clause, which specifies the columns to be displayed
• A FROM clause, which identifies the table containing the columns that are listed in the SELECT clause In the syntax:
SELECT is a list of one or more columns
DISTINCT suppresses duplicates column|expression selects the named column or the expression alias gives selected columns different headingsFROM table specifies the table containing the columnsSELECT and FROM are keywords.SELECT employee_id, last_name, ... is a clause.SELECT * FROM employees is a SQL statement.SELECT keyword with an asterisk (*). In the example in the slide, the department table contains four columns: DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, and LOCATION_ID. The table contains eight rows, one for each department.SELECT keyword. For example, the following SQL statement (like the example in the slide) displays all columns and all rows of the DEPARTMENTS table:SELECT department_id, department_name, manager_id, location_id FROM departments;SELECT statement to display specific columns of the table by specifying the column names, separated by commas. The example in the slide displays all the department numbers and location numbers from the DEPARTMENTS table.SELECT clause, specify the columns that you want, in the order in which you want them to appear in the output. For example, to display location before department number going from left to right, you use the following statement:Using the following simple rules and guidelines, you can construct valid statements that are both easy to read and easy to edit:
• SQL statements are not case-sensitive (unless indicated).
• SQL statements can be entered on one or many lines.
• Keywords cannot be split across lines or abbreviated.
• Clauses are usually placed on separate lines for readability and ease of editing.
• Indents should be used to make code more readable.
• Keywords typically are entered in uppercase; all other words, such as table names and columns, are entered in lowercase.
Executing SQL Statements
Using SQL Developer, click the Execute button to run the command or commands in the editing window.
Using SQL*Plus, terminate the SQL statement with a semicolon and then press the Enter key to run the command.
Column Heading Defaults
In SQL Developer, column headings are displayed in uppercase and centered.
SELECT last_name, hire_date, salary FROM employees;
You can override the column heading display with an alias. Column aliases are covered later in this lesson.
Next part start with - Arithmetic Expressions
Class-4 Finished. To Be Continued...
Main Author:
copyright issue: i get a copy as an Oracle certified professional (OCP) and can use for training course purpose.
This post was made from https://ulogs.org