This repository contains Oracle SQL and PL/SQL lecture, practice, and homework scripts created for a database course. The scripts focus on query writing, PL/SQL procedures, database storage internals, indexing, and execution plan analysis using Oracle-specific tools and data dictionary views.
Collection of Oracle SQL and PL/SQL lecture exercises, homework, and practice scripts covering DBA views, storage internals, indexing, query optimization, and execution plans.
oracle-database-lecture-sql-plsql
database-lecture-sql-plsqloracle-sql-plsql-practiceoracle-database-exercisesdatabase-course-oracle-sqloracle-query-optimization-lab
- Oracle SQL queries
- PL/SQL procedures
- Data dictionary and DBA views
- Database objects and tablespaces
- Segments, extents, blocks, and ROWID analysis
- Indexes and bitmap indexes
- Function-based and composite indexes
- Execution plans with
EXPLAIN PLAN - Query plan display with
DBMS_XPLAN - Join strategies and optimizer hints
- Query tuning and performance comparison
practise01.sql— introductory Oracle metadata and DBA view exercises, object types, tablespaces, and anewest_tablePL/SQL procedurepractise2.sql— storage-related Oracle practice queries using DBA viewspractise3.sql— block, rowid, segment, and empty-block analysis, including PL/SQL proceduresaramis4.sql— index-related exercises, bitmap indexes, function-based indexes, and procedures such aslist_indexesandblock_usagearamis7.sql— execution plan analysis withPLAN_TABLE,EXPLAIN PLAN, and formatted hierarchical plan outputullman7.sql— additional optimizer, execution plan, join method, and performance exercisesprac7exttra.sql— practice tasks on joins, indexes, salary-category filtering, and execution planspractise8.sql— optimizer hints, index usage, join strategies, and bitmap index exercisesHW3.sql— homework script including theempty_blocksPL/SQL procedure and related checks
These scripts are written for an Oracle Database environment and use Oracle-specific features such as:
DBA_OBJECTSDBA_TABLESDBA_SEGMENTSDBA_EXTENTSDBA_INDEXESDBA_IND_COLUMNSDBA_IND_EXPRESSIONSDBMS_ROWIDDBMS_XPLANEXPLAIN PLAN
Some scripts also reference course-specific schemas and tables such as NIKOVITS.EMP, NIKOVITS.DEPT, NIKOVITS.SAL_CAT, NIKOVITS.PRODUCT, and related tables.
- Open the
.sqlfiles in Oracle SQL Developer, SQLcl, or another Oracle-compatible SQL environment. - Run the scripts step by step instead of executing all files at once.
- Make sure the required schemas, privileges, and referenced tables exist in your database.
- Enable server output when testing PL/SQL procedures:
SET SERVEROUTPUT ON;- The repository is best presented as a course exercise collection rather than a single application.
- Some scripts are practice files, while others are homework or lecture-based solutions.
- A few files depend on access to DBA views and instructor-provided schemas.
Oracle SQL and PL/SQL database course exercises covering DBA views, storage internals, indexing, optimizer hints, and execution plan analysis.
This project is intended for educational use.