Sample Oracle Database for Learning SQL
1. Introduction
LearningSQL is a small database, used as an example in the instructions of learning SQL on the website of o7planning. There are 3 version on Databases:
- Oracle
- MySQL
- SQLServer.
In this document, I will instruct you to create this database on Oracle.
This database is used in the documentation to learn SQL (Oracle) at:
2. Download Script
Download script at:
With Oracle, you just need to care about the file:
- LearningSQL-Oracle-Script.sql
3. Run Script
There are two ways to create SCHEMA: LearningSQL
- Using SQL Plus
- Using visual tools.
Create SCHEMA LearningSQL using SQL Plus
Run 2 commands:
-- Create Schema named learningsql, password 1234
Create user learningsql identified by 1234;
-- For learning purposes:
-- Grant highest privilege DBA (DB Admin) for the newly created user.
grant dba to learningsql;
Connect to the newly created SCHEMA:
-- Connect to Schema
-- Syntax: connect <user>/<pass>@<sid>
connect learningsql/1234@db11g;
Run Script:
-- Run Script file in SQL Plus
@F:\LEARNING_SQL\LearningSQL-Oracle-Script.sql
Script run successfully:
Create SCHEMA LearningSQL using visual tool
On the visual tools (Here I use PL/SQL Developer), connected to the user with DBA authority (for example: system).
See more:
Execute script to create schema: learningsql.
-- Create schema named learningsql
Create user learningsql identified by 1234;
-- For learning purposes:
-- Grant highest privilege DBA (DB Admin) for the newly created user.
grant dba to learningsql;
Connect to Schema you just created:
Copy content of LearningSQL-Oracle-Script.sql into PL/SQL Developer and execute.
Create Schema success.
4. Overview LearningSQL Database
LearningSQL is a small database simulating the data of a bank:
Table Name | Description |
ACCOUNT | The table saves the bank accounts. Each of customer can register multiple accounts each of which corresponds to a product type provided by the bank.
(See more: PRODUCT) |
ACC_TRANSACTION | The table saves the transaction history between the bank and a certain account. |
BRANCH | The branch of bank. |
BUSSINESS | |
CUSTOMER | The table of customers |
DEPARTMENT | The department table of bank |
EMPLOYEE | The employee table of bank |
OFFICER | |
PRODUCT | The products and services of bank, such as:
|
PRODUCT_TYPE | The types of products and services, such as:
|
Oracle Database Tutorials
- Install PL/SQL Developer on Windows
- Sample Oracle Database for Learning SQL
- SQL Tutorial for Beginners with Oracle
- Install Oracle Database 11g on Windows
- Install Oracle Database 12c on Windows
- Install Oracle Client on Windows
- Create Oracle SCOTT Schema
- Sample Database
- Database structure and Cloud features in Oracle 12c
- Importing and Exporting Oracle Database
- Oracle String functions
- Split comma separated string and pass to IN clause of select statement in Oracle
- Hierarchical Queries in Oracle
- Oracle Database Link and Synonym Tutorial with Examples
- Oracle PL/SQL Programming Tutorial with Examples
- XML Parser for Oracle PL/SQL
- Standard Database Auditing in Oracle
- Creating and Managing Oracle Wallet
Show More