Download Quick review of SQL

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

DBase wikipedia , lookup

Microsoft Access wikipedia , lookup

Serializability wikipedia , lookup

Relational algebra wikipedia , lookup

Functional Database Model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Ingres (database) wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Oracle Database wikipedia , lookup

SQL wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

PL/SQL wikipedia , lookup

Transcript
Quick review of SQL
And conversion to Oracle SQL
Assuming…
• You know how to model data using
– An ER diagram
– A class diagram
• You know how to translate entityrelationship models into:
– Tables
– With constraints
SQL
• Structured Query Language
• Made up of the following components:
–
–
–
–
Data Manipulation Language (DML)
Data Definition Language (DDL)
Transaction control
Data Control Language (DCL)
• Oracle SQL complies with the core ANSI/ISO
standard for SQL:2003, but is not completely
compliant.
• It also has extensions, that are not compliant, so
are not portable to non-Oracle databases.
DML
•
•
•
•
SELECT
INSERT
UPDATE
DELETE
DDL
• CREATE
• ALTER
• DROP
– Any object in the database.
• TRUNCATE
– Deletes all rows in a table.
Transaction control
• A database transaction is a unit of work
that leaves the database in a consistent
state.
• To ensure consistency, ongoing work can
be committed, rolled back to a checkpoint,
or rolled back completely.
• COMMIT
• ROLLBACK
Data Control Language
• These control user access to an Oracle
database.
• These instructions include:
– GRANT
– REVOKE
– SET ROLE…
Exercises Lab 1, Week 1
•
•
•
•
•
•
•
•
Learn the datatypes that are used in Oracle 10g.
Retrieve all columns and rows
Retrieve specific columns
Use SQL*Plus DESCRIBE command
Specify an alias for a column
Learn the SQL built-in functions provided by Oracle.
Learn about the DUAL table.
Build SELECT clause expressions
– with the Concatenation String operator
– with arithmetic operators
– with SQL built-in functions.
• Work with NULLs in a SELECT clause expression
• Implement conditional log in SELECT clause expressions.
• Retrieve specific rows from tables.
Exercises Lab 2, Week 1
• Building WHERE clause conditions
– with relational operators
– With subqueries
• Building composite WHERE Clause conditions with
logical operators
• Grouping records in a query’s result set.
• Rolling up groups into supergroups.
• Ordering records in a query’s result set
• Building an inner join of two tables
• Building an outer join of two tables.
• Inserting new rows in a table
• Deleting rows from a table.
Lab 1 Week 2
• Committing and Rolling back transactions
• Writing and storing scripts.
Lab 2 Week 2
• Data Definition Language
• DCL
References
‘Hands-on Oracle Database 10g Express
Edition for Windows’, Bobrowski, S.,
Oracle Press, McGraw Hill / Osborne,
2006.
‘Oracle Database 10g A Beginner’s guide’,
Abramson, I., Abbey, M., Corey, M., Oracle
Press, McGraw Hill / Osborne, 2004.