0% found this document useful (0 votes)
23 views14 pages

Lab Work - Msaurav

This lab report provides an overview of SQLPlus, a command-line tool for interacting with Oracle Databases, detailing its features, advantages, and limitations. It includes practical lab work involving user creation, table management, and SQL commands, demonstrating hands-on experience with database operations. The conclusion reflects on the knowledge gained and skills developed in database management tasks.

Uploaded by

kritikshahi07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views14 pages

Lab Work - Msaurav

This lab report provides an overview of SQLPlus, a command-line tool for interacting with Oracle Databases, detailing its features, advantages, and limitations. It includes practical lab work involving user creation, table management, and SQL commands, demonstrating hands-on experience with database operations. The conclusion reflects on the knowledge gained and skills developed in database management tasks.

Uploaded by

kritikshahi07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

GOLDENGATE INTERNATIONAL COLLEGE

Battisputali, Kathmandu

Lab Report
on
SQLPLUS

Submitted by: Submitted to:


Saurav Dangol Computer Science Department
Roll no. : Goldengate International College
BBM, 6th Sem Submitted on:
TABLE OF CONTENTS

INTRODUCTION ........................................................................................................ 1
LAB WORK ................................................................................................................. 4
CONCLUSION ........................................................................................................... 11
REFERENCES ........................................................................................................... 12
INTRODUCTION

SQLPlus is a command-line tool


provided by Oracle Corporation for
interacting with Oracle Databases. It
is commonly used by database
administrators (DBAs), developers,
and analysts for tasks such as
executing SQL queries, running
PL/SQL scripts, managing database objects, and generating formatted reports. SQLPlus
is a versatile tool for Oracle database management, suitable for professionals who prefer
or require command-line operations. It is particularly useful for scripting, automation,
and quick database interactions.

Key Features of SQLPlus


1. Database Interaction:
 Execute SQL commands to retrieve, manipulate, and manage data.
 Run DDL (Data Definition Language) commands like CREATE, ALTER,
and DROP.
 Execute DML (Data Manipulation Language) commands like INSERT,
UPDATE, DELETE, and SELECT.
2. PL/SQL Execution:
 Run PL/SQL blocks to write procedural logic for business rules and
automation.
 Test stored procedures, functions, packages, and triggers.
3. Scripting and Automation:
 Write SQL scripts (.sql files) to execute multiple SQL statements and
commands in sequence.
 Use scripts for repetitive tasks and scheduled jobs.
4. Customizable Reporting:
 Format query results for reports using SQLPlus commands like SET,
COLUMN, and BREAK.

1
 Generate tabular, text, or custom reports for business needs.
5. System and Session Management:
 Manage database sessions by connecting, disconnecting, or switching
users.
 Execute administrative commands like SHOW, DESCRIBE, and SET.

6. Command-Line Functionality:
 Allows users to interact with the database directly through a terminal or
shell environment.

Advantages of SQLPlus
 Lightweight and easy to use.
 Direct interaction with the Oracle database.
 Ability to execute scripts and commands in batch mode.
 Support for session-level customization.
 Platform-independent (available on Windows, Linux, macOS, etc.).

Limitations
 No graphical user interface (GUI); it is purely command-line based.
 Formatting output requires manual configuration.
 Limited interactivity compared to GUI tools like Oracle SQL Developer.

Important Constraints in SQL


Constraints are rules enforced on data in a table to maintain data integrity and
accuracy.
1. NOT NULL: Ensures that a column cannot have a NULL value.
2. UNIQUE: Ensures that all values in a column are unique.
3. PRIMARY KEY: A combination of NOT NULL and UNIQUE. Uniquely
identifies a record in a table.
4. FOREIGN KEY: Links two tables and ensures referential integrity.
5. CHECK: Ensures that all values in a column satisfy a specific condition.
6. DEFAULT: Sets a default value for a column if no value is provided.

2
Common SQL Formulas and Calculations

1. Counting Records:
Count the total number of records in a table.
2. Sum of a Column:
Calculate the total of a numeric column (e.g., sales).
3. Average Value:
Compute the average value of a column.
4. Maximum and Minimum Values:
Find the highest or lowest value in a column.

3
LAB WORK
1. Create User and grant dba to user.

2. Create table employee ( Eno, Name, Address, Sal, Job_status, Deptno)

3. Add not null constraint in table Employee

4
4. Insert Minimum 5 values in Employee Table

5. Find the highest and lower Salary from Employee table.

5
6. Find the total expenses in salary

7. Find the Name of Employee from Old Baneshwor.

8. Find the Name of Employee whose sal is between 20000 to 50000.

9. Adding Constraint Primary Key in existing Employee table.

6
10. Adding Contact column in Employee.

11. Insert value in Contact only in Employee Name Sharon Chaudhary.

7
12. Create Department table.

13. Insert values into department table.

14. Add foreign in department table.

15. Duplicating the table.

8
16. Inner Joins

17. Left Joins

9
18. Right Joins

19. Full Outer Joins

10
CONCLUSION

Through my exploration of SQLPlus, I have gained valuable knowledge and hands-on


experience with various database management tasks. I successfully learned how to
create tables using the CREATE TABLE command, modify existing table structures
with the ALTER TABLE command, and remove tables using the DROP TABLE
command. Additionally, I became familiar with executing SQL queries, managing data
through INSERT, UPDATE, and DELETE commands, and formatting output for
reports. These skills have enhanced my understanding of database operations and
prepared me for more advanced tasks in database administration and development.

11
REFERENCES

[Link]. (n.d.). [Link]

How to download and setup SQLPlus for running SQL commands? (n.d.). Stack Overflow.
[Link]
for-running-sql-commands

GeeksforGeeks. (2024, June 6). SQL*Plus Command Reference. GeeksforGeeks.


[Link]

12

You might also like