Professional Documents
Culture Documents
Summer Internship Program (WEEK 4) : Presented By: Shreya Gaur
Summer Internship Program (WEEK 4) : Presented By: Shreya Gaur
INTERNSHIP
PROGRAM
(WEEK 4)
PRESENTED BY :
SHREYA GAUR
SQL
(STRUCTUR
ED QUERY
LANGUAGE)
3
4
Oracle Basic Data Types:
✗ CHAR(size)
✗ VARCHAR(size)/ VARCHAR2(size)
✗ DATE – standard format is DD-MON-YY
✗ NUMBER(P, S)
✗ LONG
✗ RAW/ LONG RAW
5
Components of SQL:
6
✗ DDL – Data Definition Language: It is a set of SQL commands used to
create, modify and delete database structures but not data.
CREATE
ALTER
DROP
TRUNCATE
Syntax:
CREATE TABLE <table_name>
(<column_name1> <datatype>(<size>), <column_name2> <datatype>(<size>));
7
✗DML – Data Manipulation Language
INSERT
UPDATE
DELETE
Syntax:
INSERT INTO <table_name> (<columnname1>, <columnname2>)
VALUES (<expression1>, <expression2>);
8
✗ DCL – Data Control Language
COMMIT
SAVEPOINT
ROLLBACK
GRANT/ REVOKE
9
✗DQL – Data Query Language
SELECT
10
Displaying the TABLE Structure
DESCRIBE Command:
✗ Display information about the columns defined in a table
Syntax:
DESCRIBE <table_name>;
OR
DESC <table_name>;
11
SQL: SELECT statement – with where
clause
Selected Columns & Selected Rows:
SYNTAX
12
SQL Constraints
✘ SQL constraints are used to specify rules for the data in a table.
✘ Constraints are used to limit the type of data that can go into a table. This ensures
the accuracy and reliability of the data in the table. If there is any violation
between the constraint and the data action, the action is aborted.
✘ Constraints can be column level or table level. Column level constraints apply to a
column, and table level constraints apply to the whole table.
13
The Following Constraints Are Commonly
Used In SQL:
✘ NOT NULL
✘ UNIQUE
✘ PRIMARY KEY
✘ FOREIGN KEY
✘ CHECK
✘ DEFAULT
✘ CREATE INDEX
14
Pl/SQL
15
PL/SQL is a combination of SQL along with the
procedural features of programming languages. It
was developed by Oracle Corporation in the early
90's to enhance the capabilities of SQL. PL/SQL is
one of three key programming languages embedded
in the Oracle Database, along with SQL itself and
Java. This tutorial will give you great understanding
on PL/SQL to proceed with Oracle database and
other advanced RDBMS concepts
16
Features of PL/SQL:
variable_name [CONSTANT] datatype [NOT NULL] [:= |
DEFAULT initial_value]
18
OUTPUT:
Example of initilizing Value of c: 70
Value of f: 33.333333333333333333
variable
Let's take a simple example to explain it well: PL/SQL procedure successfully comp
leted.
DECLARE
a integer := 30;
b integer := 40;
c integer;
f real;
BEGIN
c := a + b;
dbms_output.put_line('Value of c: ' || c);
f := 100.0/3.0;
dbms_output.put_line('Value of f: ' || f);
END;
19
THANKS!
20