Chapter 2: SQL – The Basics Objectives: The SQL execution environment SELECT statement

advertisement
Chapter 2: SQL – The Basics
Objectives:
1. The SQL execution environment
2. SELECT statement
3. SQL Developer & SQL*Plus
Overview: SQL execution environment
• Oracle can run on many different OS
• Oracle databases server is where the
Oracle DB software resides
• Oracle provides SQL Developer & SQL*Plus
tools/interfaces for connecting with the
DB & executing your SQL queries
• Other third party tools are available that
are mentioned on Appendix H of the
textbook
Let’s get started…
• Execution environment & setting up STUDENT schema
•
•
•
•
Accessing Oracle database server
Getting started with SQL Developer
SQL and the Oracle database server
Creating a database connection for SQL Developer
• Exploring database table objects
•
•
•
•
•
•
Columns tab
Data tab
Grants tab
Statistics tab
Triggers, dependencies, indexes, flashbacks, and SQL tabs
Details tab
• SQL Developer worksheet
• Results tab
Various SQL Developer Panes
Data types
A data type determines the type of data that can
be stored in a column. You must keep data types
in mind especially when using comparison
operators, in other words, comparing the values in
two columns.
• DATE
• NUMBER
• CHAR
• VARCHAR2
SQL SELECT statement
• Components of a SELECT
statement
• Selecting one, multiple or all
columns
• Eliminating duplicates with
DISTINCT or UNIQUE
SQL Worksheet Icons
• Constructing & formatting SQL SELECT statement
in SQL Developer
•
•
•
•
•
•
•
•
Execute Statement
Run Script
Commit
Rollback
Cancel
Execute Explain Plan
Auto Trace
Clear
• Formatting SQL statement in SQL
Developer
• Syntax formatting
• Code completion
• Syntax highlighting
• Writing multiple statements in the SQL
Developer
• SQL statement history in SQL Developer
SQL*Plus
• Starting SQL*Plus
• Executing SQL commands in SQL*Plus
• Formatting SQL*Plus results
Download