<aside> <img src="/icons/table_red.svg" alt="/icons/table_red.svg" width="40px" /> Table of Contents
</aside>
Sr no | Topic | Date | Page no | Signature |
---|---|---|---|---|
1 | Data Definition Language (DDL) | |||
● CREATE | ||||
● ALTER | ||||
● DROP | ||||
● RENAME | ||||
● TRUNCATE |
Data Manipulation Language (DML) ● INSERT ● UPDATE ● DELETE ● SELECT Data Control Language (DCL) ● GRANT ● REVOKE ● ROLES | 09-09-24 | | | | 2 | SQL SELECT Statements ● Selecting All Columns ● Selecting Specific Columns ● Column Alias ● Concatenation Operator ● Arithmetic Operators ● Comparison Conditions ● Logical Conditions ● ORDER BY Clause | 19-9-24 | | | | 3 | Functions ● Single Row Functions: ● Character Functions ● Number Functions ● Date Functions, Conversion ● Functions ● General Functions ● Multiple Row Functions | 25-10-24 | | | | 4 | Constraints ● Not Null ● Unique Key ● Primary Key ● Foreign Key ● Check ● Dropping a Constraint ● Enabling & Disabling Subquery ● Group ● Function ● Having Clause | 09-09-24 11-11-24 | | | | 5 | Joins ● Equijoins ● Non-Equijoins ● Joining Three Tables ● Self Joins, Left Outer Joins ● Right Outer Joins ● Full Outer Joins ● Cross Joins ● Natural Joins | 11-11-24 | | | | 6 | Sequence, View, Index, Synonyms | | | | | 7 | PL/SQL Practical Programming ● Variable ● Identifiers ● Comment ● PL/SQL Block Structure IF Statements
● Simple IF Statements ● Compound IF Statements ● IF-THEN-ELSE Statements | 21-11-24 | | | | 8 | Loop ● BasicLoop ● WHILE Loop ● FOR Loop Transaction Control ● Commit ● Rollback ● Save point | 21-11-24 07-10-24 | | | | 10 | Cursor ● Types of Cursor ● Explicit Cursor Life Cycle ● Explicit Cursor Attributes | 25-11-24 | | | | 11 | Exceptions ● Block Structure ● Exception Handlers ● Types of Exceptions Records ● Table-Based ● Cursor-Based ● Programmer-Defined | 25-11-24 25-11-24 | | | | 8 | Loop ● BasicLoop ● WHILE Loop ● FOR Loop Transaction Control ● Commit ● Rollback ● Save point | 21-11-24 07-10-24 | | | | 10 | Cursor ● Types of Cursor ● Explicit Cursor Life Cycle ● Explicit Cursor Attributes | 25-11-24 | | | | 11 | Exceptions ● Block Structure ● Exception Handlers ● Types of Exceptions Records ● Table-Based ● Cursor-Based ● Programmer-Defined | 25-11-24 25-11-24 | | | | 12 | Functions ● Create Function ● Function with Arguments ● Executing Function ● Dropping Function | 25-11-24 | | | | 13 | Procedures ● Block Structure of Subprogram ● Types of Subprograms ● Procedure with Parameters ● Executing Procedures ● Dropping Procedures | 05-12-24 | | | | 14 | Trigger ● Trigger ● Statement Trigger ● Row Trigger ● Using Conditional Operations ● DML Operations | 25-11-24 | | | | 15 | Packages ● Package Specification ● Package Body ● Creating Packages ● Execution ● Dropping Packages | 05-12-24 | | |
Prerequisites
DDL - Data Definition Language:
Command | Description |
---|---|
CREATE | Creates a new table, a view of a table, or other objects in database |
ALTER | Modifies an existing database object, such as a table. |
DROP | Deletes an entire table, a view of a table or other object in the database. |
DML - Data Manipulation Language:
Command | Description |
---|---|
INSERT | Creates a record |
UPDATE | Modifies records. |
DELETE | Deletes records. |
DML - Data Control Language:
Command | Description |
---|---|
GRANT | Gives a privilege to user. |
REVOKE | Takes back privileges granted from User. |
DML - Data Query Language:
Command | Description |
---|---|
SELECT | Retrives certain records from one or more tables. |
To create a Table.
Synatax:
CREATE TABLE schema_name.table_name (
column_1 data_type column_constraint,
column_2 data_type column_constraint,
...
table_constraint
);
Create a relation CUSTOMERS with the following attributes.
ID of integer type and primary key.
Name 20 characters.
Age integer.
Address 25 characters.
Salary floating point 10.2 assign a default value 5000.
Solution Command:
CREATE TABLE customers_1 (
ID int primary key,
cname varchar(20),
age int,
Address varchar(20),
salary number(10, 3) default 1000.00
);
Solution Output:
Create a table SUPPLIER.
Supplier_id.
Supplier_name.
Contact_name.
Solution Command 1:
CREATE TABLE supplier_1 (
supplier_id int primary key,
supplier_name varchar(20),
contact varchar(20)
);
Solution Output 1:
Solution Command 2:
CREATE TABLE supplier_2 (
supplier_id numeric(10),
supplier_name varchar2(50),
contact_name varchar2(50),
CONSTRAINT supplier_pk_1 PRIMARY KEY(supplier_id)
);
Solution Output 2:
Create a table SUPPLIER, but with COMPOSITE KEY.
Solution Command:
CREATE TABLE supplier_3 (
supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk_3 PRIMARY KEY(supplier_id, supplier_name)
);
Solution Output:
Describe all the tables, which we’ve created above by using command DESCRIBE.
Character Datatypes:
Numeric Datatypes:
DATE/TIME Datatypes: