Essential PL/SQL Triggers, Procedures, and DDL Examples

Database Triggers for Data Integrity

Create table emp1 and dept1 same as emp and dept. Create a trigger which will delete all records from emp1 table of corresponding department deleted from dept1 table.

CREATE TABLE emp1 AS SELECT * FROM emp;
CREATE TABLE dept1 AS SELECT * FROM dept;

CREATE OR REPLACE TRIGGER trg_delete_emp1
AFTER DELETE ON dept1
FOR EACH ROW
BEGIN
    DELETE FROM emp1 WHERE deptno = :OLD.deptno;
END;
/

Create table totalsal as select deptno, sum(sal) sal from emp1 group by deptno.

Read More

Essential Cisco IOS Configuration Commands

Cisco IOS Navigation and Modes

User mode: Switch>

Enter Privilege mode: Switch>enable

Privileged mode: Switch#

Enter configuration mode: Switch#configure terminal

Global Config mode: Switch(config)#

Enter Interface mode: Switch(config)#interface fa0/1

Interface mode: Switch(config-if)

Return to global configuration: Switch(config-if)exit

Exit Global Config mode: Switch(config)#exit

Return to user mode: Switch#disable

Logout: Switch>exit

Essential Keyboard Shortcuts

  • Recall Previous command: Up arrow
Read More

Cisco Network Configuration: IPv6, OSPF, and HSRP Setup

Part 1: Network Infrastructure and Addressing

Task 1: IPv6 Interface Configuration

Router A1

enable
configure terminal
ipv6 unicast-routing
interface g0/0
ipv6 address 2001:1:1:1::2/64
no shutdown
interface s0/0/0
ipv6 address 2001:c1c0:34:11::1/64
no shutdown
clock rate 2000000
interface s0/0/1
ipv6 address 2001:c1c0:34:12::1/64
no shutdown
clock rate 2000000

Router A2

enable
configure terminal
ipv6 unicast-routing
interface g0/0
ipv6 address 2001:c1c0:34:1::1/64
no shutdown
interface s0/0/0
ipv6 address 2001:c1c0:34:11:

Read More

Practical SQL Examples for Database Management

Student and Course Database Examples

Database Creation

It’s good practice to create a dedicated database for your tables.

-- Create a new database (optional, good practice)
CREATE DATABASE IF NOT EXISTS StudentDB;
USE StudentDB;

Table Creation

Here, we define the Student and Course tables. Note the use of PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, and CHECK constraints.

CREATE TABLE Student (
    StudentID INT PRIMARY KEY AUTO_INCREMENT,
    Name VARCHAR(100) NOT NULL,
    Dept VARCHAR(50),
    Age INT,
Read More

Java JDBC MySQL CRUD: Data Manipulation Examples

Java JDBC CRUD: MySQL Database Interaction

This document provides practical Java code examples demonstrating basic CRUD (Create, Read, Update, Delete) operations on a MySQL database using JDBC (Java Database Connectivity).

Each example connects to a local MySQL database named mydb with user root and an empty password. It’s important to note that for production environments, using PreparedStatement is highly recommended to prevent SQL injection vulnerabilities, and sensitive credentials should not

Read More

Advanced SQL Queries for Database Analytics

This document presents a collection of practical SQL queries designed to extract valuable insights from a database, likely a music store schema such as Chinook. Each query demonstrates different SQL concepts, from basic data retrieval to complex joins, subqueries, and aggregations, providing solutions for common business questions.

  1. Top 10 Customers by Spending (Over $40)

    Identifies the top 10 customers who have spent more than $40 in total, ordered by their total expenditure in descending order.

    SELECT 
Read More