What is SQL?
SQL (Structured Query Language) is a standard language used to communicate with relational databases. It is used to create, store, retrieve, update, and delete data from databases.
Features of SQL
- Create databases and tables
- Insert, update, and delete records
- Retrieve data using queries
- Define relationships between tables
- Control user access and permissions
Example SQL Commands
-- Create a table
CREATE TABLE Student (
StudentID INT,
Name VARCHAR(50),
City VARCHAR(30)
);
-- Insert data
INSERT INTO Student VALUES (1, 'Rahul', 'Rajkot');
-- Retrieve data
SELECT * FROM Student;
-- Update data
UPDATE Student
SET City = 'Ahmedabad'
WHERE StudentID = 1;
-- Delete data
DELETE FROM Student
WHERE StudentID = 1;
What is SQL*Plus?
SQL*Plus is a command-line tool provided by the Oracle Corporation for interacting with Oracle databases.
It allows users to:
- Execute SQL statements
- Run PL/SQL programs
- Create reports
- Manage Oracle databases
- Save query results to files
Features of SQL*Plus
- Command-line interface for Oracle Database
- Supports SQL and PL/SQL execution
- Generates formatted reports
- Executes script files (
.sql) - Database administration tasks
Example SQL*Plus Session
SQL> CONNECT system/password;
Connected.
SQL> SELECT * FROM Student;
STUDENTID NAME CITY
--------- ----- ----------
1 Rahul Rajkot
Difference Between SQL and SQL*Plus
| SQL | SQL*Plus |
|---|---|
| A database query language | A tool/environment for running SQL |
| Standard language used with many DBMSs | Oracle-specific utility |
| Used to manipulate and query data | Used to execute SQL and PL/SQL commands |
| Consists of commands like SELECT, INSERT, UPDATE | Provides commands like CONNECT, SPOOL, DESCRIBE |
| Language only | Software tool |
In Simple Words
- SQL = The language used to communicate with databases.
- SQL*Plus = Oracle’s tool that lets you write and execute SQL commands.
Example:
If SQL is a language like English, then SQL*Plus is a text editor where you write and run that language.