0% found this document useful (0 votes)
87 views

ADBMS LabFile Final

The document describes experiments conducted in an Advanced Database Management Systems (ADBMS) lab course. It includes: 1. Comparing databases like PostgreSQL, MySQL and MariaDB, and installing PostgreSQL. 2. Writing SQL queries on a student table including DDL commands like CREATE and ALTER, DML commands like INSERT and UPDATE, DCL commands like GRANT and REVOKE, and built-in functions. 3. Creating views and PL/SQL functions to perform tasks like adding numbers, counting courses, and checking if a number is even or odd. 4. Using cursors to update student marks, handling exceptions, averaging marks by branch, and creating triggers for insertions and

Uploaded by

Mayank
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

ADBMS LabFile Final

The document describes experiments conducted in an Advanced Database Management Systems (ADBMS) lab course. It includes: 1. Comparing databases like PostgreSQL, MySQL and MariaDB, and installing PostgreSQL. 2. Writing SQL queries on a student table including DDL commands like CREATE and ALTER, DML commands like INSERT and UPDATE, DCL commands like GRANT and REVOKE, and built-in functions. 3. Creating views and PL/SQL functions to perform tasks like adding numbers, counting courses, and checking if a number is even or odd. 4. Using cursors to update student marks, handling exceptions, averaging marks by branch, and creating triggers for insertions and

Uploaded by

Mayank
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 66

RUCHIR BISHT 05914802717 7-C-4

Advanced Database Management System

(ADBMS) Lab

ETCS 457

Faculty Name: Mrs. Savita Sharma Student Name: RUCHIR BISHT

Enrolment No: 05914802717

Semester : 7th Sem

Maharaja Agrasen Institute of Technology, PSP Area,

Sector – 22, Rohini, New Delhi – 110086

List of Experiments
RUCHIR BISHT 05914802717 7-C-4

1. (a) Compare different Databases such as PostgreSQL, MySQL and Maria DB.
(b) Installation of PostgreSQL.
2. Consider Schema: Student (Student Id, Student name, age, student Percentage). Write
SQL queries on Student Info Table:

a. DDL (e.g. create, alter, drop, rename, truncate),

b. DML (e.g. Insert, update, delete etc.),

c. DCL (e.g. Grant, revoke etc.)

d. Built-in Functions (e.g. Sum, min, max, avg, count, lower, upper, etc.)

e. Views: Create and Drop View

3. Perform Nested Queries in PostgreSQL.


4. Create a PLSQL Function to:
a. Add 2 numbers (if single argument then increments by 1 otherwise return the
sum)
b. Find the number of course in the college
c. Count (*) from the company table.
5. Create a PLSQL Function to:
a. Function to compare two numbers
b. Find the greatest of Three numbers
c. Check whether the number is Even-Odd.
6. Write the cursor to increase the marks of student by 10%.
7. Write a program to create exceptions if enrollment no. is not issued to student by the
university and raise the exception explicitly by using raise command.
8. (a) Write the procedure to get the average marks of students for branch “CSE”.
(b) Write a function that accepts branch and returns the total no. of students of the
branch.
9. (a) Create a trigger on table after inserting a new student into table.
(b) Write a row trigger to insert the existing values of the student table into a new
table when the marks of student are updated.

Experiment-01(a)
RUCHIR BISHT 05914802717 7-C-4

Aim: Compare different Databases such as PostgreSQL, MySQL and Maria DB.
Name MariaDB MySQL PostgreSQL
MySQL application Widely used Widely used open
Description compatible open open source RDBMS
source RDBMS, source RDBMS
Primary
database model Relational DBMS Relational DBMS Relational DBMS
Document store Document store Document store
Secondary Graph DBMS
database
models
Website mariadb.com www.mysql.com www.postgresql.org
MariaDB Oracle PostgreSQL Global
Developer Corporation Ab Development Group
(MariaDB
Enterprise)
Initial release 2009 1995 1989
Current release 10.4.12, Jan 2020 8.0.21, Feb 2020 12.4, Aug 2020
License Open Source  Open Source Open Source

Implementatio C and C++ C and C++ C


n language
BSD
Linux
Server BSD BSD NetBSD
operating Linux Linux OpenBSD
systems Solaris OS X OS X
Windows Solaris Solaris
Windows Unix
Windows
Data scheme yes  yes yes
XML support yes yes yes 
SQL  yes  yes  yes 

Experiment-01(b)
RUCHIR BISHT 05914802717 7-C-4

Aim: Installation of PostgreSQL.


Steps: Step 1: Open the downloaded exe and Click next on the install welcome
screen.

Step 2: Change the Installation directory if required, else leave it to default. Click
Next.
RUCHIR BISHT 05914802717 7-C-4

Step 3: You may choose the components you want to install in your system. You may
uncheck Stack Builder. Click Next.

Step 4: You may change the data location. Click Next.

Step 5: Enter root user password. Make a note of it. Click Next.

Step 6: Leave the port number default. Click Next.


RUCHIR BISHT 05914802717 7-C-4

Step 7: Select the nearest geographic location for the new database cluster.

Step 8: Check the pre-installation summary. Click Next


RUCHIR BISHT 05914802717 7-C-4

Step 9: Click the next button. And the installation process with start and wait for few
minutes.

Step 10: Once install is complete you will see the Stack Builder prompt

 Uncheck that option. We will use Stack Builder in more advance tutorials
 Click Finish.

Step 11: To launch PostgreSQL go to Start Menu and search PostgreSQL. And then
open pgAdmin 4 for Graphical user interface(GUI) and SQL SHELL(psql) for
command line Interface(CLI).
RUCHIR BISHT 05914802717 7-C-4

Step 12: You will see pgAdmin homepage and SQL Command interface(psql).
RUCHIR BISHT 05914802717 7-C-4

Experiment-02
AIM: Consider Schema: Student (Student Id, Student name, age, student Percentage).
Write SQL queries on Student Info Table:
a. DDL (e.g. create, alter, drop, rename, truncate),
b. DML (e.g. Insert, update, delete etc.),
c. DCL (e.g. Grant, revoke etc.)
d. Built-in Functions (e.g. Sum, min, max, avg, count, lower, upper, etc.)
e. Views: Create and Drop View

1. Data Definition (DDL) Commands


This section of the article consists of those commands, which you can define
your database. The commands are:
1. CREATE:
The CREATE TABLE statement is used to create a new table in a
database.

Syntax:
CREATE SCHEMA Schema_Name;

2. ALTER:
The ALTER TABLE statement is used to either add, modify or delete
constraints and columns from a table.

Syntax:
ALTER TABLE table_name
ADD column_name datatype;
RUCHIR BISHT 05914802717 7-C-4

3. DROP:
The DROP TABLE statement is used to drop the entire table with all its
values.

Syntax:
DROP TABLE table_name;

4. TRUNCATE:
The TRUNCATE statement is used to delete the data which is present
inside a table, but the table doesn’t get deleted.

Syntax:
TRUNCATE TABLE table_name;
RUCHIR BISHT 05914802717 7-C-4

2. Data Definition (DDL) Commands


This section of the article consists of the commands, by which you can
manipulate your database. The commands are:

1. INSERT:
The INSERT statement is used to insert new records in a table.

Syntax:

The INSERT INTO statement can be written in the following two ways:
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
Or
INSERT INTO table_name VALUES (value1, value2, value3, ...);

2. UPDATE:
The UPDATE statement is used to modify the existing records in a table.

Syntax:

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
RUCHIR BISHT 05914802717 7-C-4

3. DELETE:
The DELETE statement is used to delete existing records in a table.

Syntax:

DELETE FROM table_name WHERE condition;

4. SELECT:
The SELECT statement is used to select data from a database and the data
returned is stored in a result table, called the result-set.

Syntax:

SELECT column1, column2, ... FROM table_name;


OR
SELECT * FROM table_name; Note: (*) is used to select all from the table
RUCHIR BISHT 05914802717 7-C-4

3. Data Control (DCL) Commands


This section consists of those commands which are used to control privileges in
the database. The commands are:

1. GRANT:
The GRANT command is used to provide user access privileges or other
privileges for the schema.

Syntax:

GRANT privileges ON object TO user;

2. REVOKE:
The REVOKE command is used to withdraw user’s access privileges
given by using the GRANT command.

Syntax:

REVOKE privileges ON object FROM user;

4. Built-in Functions (Aggregate Functions)


The following section of the article will include functions such as:

1. MIN:
The MIN function returns the smallest value of the selected column in a
table.
RUCHIR BISHT 05914802717 7-C-4

Syntax:

SELECT MIN(column_name)
FROM table_name
WHERE condition;

2. MAX:
The MAX function returns the largest value of the selected column in a
table.

Syntax:

SELECT MAX (column_name)


FROM table_name
WHERE condition;
RUCHIR BISHT 05914802717 7-C-4

3. COUNT:
The COUNT function returns the number of rows that match the
specified criteria.

Syntax:

SELECT COUNT (column_name)


FROM table_name
WHERE condition;

4. AVG:
The AVG function returns the average value of a numeric column that
you choose.

Syntax:

SELECT AVG (column_name)


FROM table_name
WHERE condition;
RUCHIR BISHT 05914802717 7-C-4

5. SUM:
The SUM function returns the total sum of a numeric column that you
choose.

Syntax:

SELECT SUM(column_name)
FROM table_name
WHERE condition;

5. Views (Create and Drop View)


A view is a single table, which is derived from other tables. So, a view contains
rows and columns similar to a real table and has fields from one or more table.

1. CREATE:
The CREATE VIEW statement is used to create a view from an existing
table.
Syntax

CREATE VIEW view_name AS


SELECT column1, column2, ..., columnN
FROM table_name
WHERE condition;
RUCHIR BISHT 05914802717 7-C-4

2. DROP VIEW:
The DROP VIEW statement is used to delete a view.

Syntax
DROP VIEW view_name;
RUCHIR BISHT 05914802717 7-C-4

EXPERIMENT - 03
AIM: Perform Nested Queries in PostgreSQL.
1. SELECT
To display all the schema and data in the database.

a. student table.

b. course table.

c. student_course table
RUCHIR BISHT 05914802717 7-C-4

2. IN
The IN operator allows you to specify multiple values in a WHERE clause.
The IN operator is a shorthand for multiple OR conditions.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (SELECT STATEMENT);

3. NOT IN
The NOT IN operator allows you to exclude multiple values in a WHERE
clause.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name NOT IN (SELECT STATEMENT);
RUCHIR BISHT 05914802717 7-C-4

4. EXISTS
The EXISTS operator is used to test for the existence of any record in a
subquery.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE EXISTS
(SELECT column_name FROM table_name WHERE condition);

5. ANY
The ANY operator returns true if any of the subquery values meet the
condition.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name operator ANY
(SELECT column_name FROM table_name WHERE condition);
RUCHIR BISHT 05914802717 7-C-4

6. ALL

The ALL operator returns true if all of the subquery values meet the condition.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name operator ALL
(SELECT column_name FROM table_name WHERE condition);

7. INNER JOIN

The INNER JOIN keyword selects records that have matching values in both
tables.

Syntax:
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;

8. LEFT JOIN
The LEFT JOIN keyword returns all records from the left table (table1), and
the matched records from the right table (table2). The result is NULL from the
right side, if there is no match.
RUCHIR BISHT 05914802717 7-C-4

Syntax:
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;

9. RIGHT JOIN
The RIGHT JOIN keyword returns all records from the right table (table2), and
the matched records from the left table (table1). The result is NULL from the
left side, when there is no match.

Syntax:
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;

10. FULL OUTER JOIN


The FULL OUTER JOIN keyword returns all records when there is a match in
left (table1) or right (table2) table records.
RUCHIR BISHT 05914802717 7-C-4

Syntax:
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name;

11. CROSS JOIN


The CROSS JOIN keyword returns records as cartesian product.

Syntax:
SELECT column_name(s)
FROM table1
CROSS JOIN table2;
RUCHIR BISHT 05914802717 7-C-4

Experiment-04
AIM: Create a PLSQL Function to:
1. Add 2 numbers (if single argument then increments by 1 otherwise return the
sum)
2. Find the number of course in the college
3. Count (*) from the company table.
PostgreSQL functions
PostgreSQL functions, also known as Stored Procedures, allow you to carry out
operations that would normally take several queries and round trips in a single
function within the database. Functions allow database reuse as other applications can
interact directly with your stored procedures instead of a middle-tier or duplicating
code.
Functions can be created in a language of your choice like SQL, PL/pgSQL, C,
Python, etc.
Syntax:
CREATE [OR REPLACE] FUNCTION function_name (arguments)
RETURNS return_datatype AS $variable_name$
DECLARE
declaration;
BEGIN
< function_body >
RETURN { variable_name | value }
END;
LANGUAGE plpgsql | sql | etc;
1. Function to Add 2 numbers (if single argument then increments by 1
otherwise return the sum)

Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:
Add a new function , in the general section enter the function name and
comment field is optional so as to describe the function logic or working.

Then in the Definition section select the return type , Language and the
function parameters or variables and their data type , default value , variable
name and Mode (IN , OUT , INOUT).
RUCHIR BISHT 05914802717 7-C-4

Then write the Code logic within the Begin and End keywords.

Then click on the Save button .


RUCHIR BISHT 05914802717 7-C-4

Output
RUCHIR BISHT 05914802717 7-C-4

2. Function to find the number of course in the college.


Using CLI:

Using GUI:

Add a new function , in the general section enter the function name and
comment field is optional so as to describe the function logic or working.
RUCHIR BISHT 05914802717 7-C-4

Then in the Definition section select the return type , Language and the
function parameters or variables and their data type , default value , variable
name and Mode (IN , OUT , INOUT).

Then write the Code logic within the Begin and End keywords
RUCHIR BISHT 05914802717 7-C-4

Then click on the Save button .

Output
RUCHIR BISHT 05914802717 7-C-4

3. Function to Count (*) from the company table .


Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:
Add a new function , in the general section enter the function name and
comment field is optional so as to describe the function logic or working.
RUCHIR BISHT 05914802717 7-C-4

Then in the Definition section select the return type , Language and the
function parameters or variables and their data type , default value , variable
name and Mode (IN , OUT , INOUT).

Then write the Code logic within the Begin and End keywords
RUCHIR BISHT 05914802717 7-C-4

Then click on the Save button .

Output
RUCHIR BISHT 05914802717 7-C-4
RUCHIR BISHT 05914802717 7-C-4

Experiment-05
AIM : Create a PLSQL Function to:
1. Function to compare two numbers
2. Find the greatest of Three numbers
3. Check whether the number is Even-Odd.
PostgreSQL functions
PostgreSQL functions, also known as Stored Procedures, allow you to
carry out operations that would normally take several queries and round
trips in a single function within the database. Functions allow database
reuse as other applications can interact directly with your stored
procedures instead of a middle-tier or duplicating code.
Functions can be created in a language of your choice like SQL,
PL/pgSQL, C, Python, etc.

Syntax:
CREATE [OR REPLACE] FUNCTION function_name (arguments)
RETURNS return_datatype AS $variable_name$
DECLARE
declaration;
BEGIN
< function_body >
RETURN { variable_name | value }
END;
LANGUAGE plpgsql | sql | etc;

4. Function to compare two numbers .


Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:
Add a new function , in the general section enter the function name
and comment field is optional so as to describe the function logic or
working.

Then in the Definition section select the return type , Language and
the function parameters or variables and their data type , default
value , variable name and Mode (IN , OUT , INOUT).
RUCHIR BISHT 05914802717 7-C-4

Then write the Code logic within the Begin and End keywords.

Then click on the Save button .


RUCHIR BISHT 05914802717 7-C-4

Output

5. Function to find the largest of three numbers


RUCHIR BISHT 05914802717 7-C-4

Using GUI:

Add a new function , in the general section enter the function name
and comment field is optional so as to describe the function logic or
working.
RUCHIR BISHT 05914802717 7-C-4

Then in the Definition section select the return type , Language and
the function parameters or variables and their data type , default
value , variable name and Mode (IN , OUT , INOUT).

Then write the Code logic within the Begin and End keywords
RUCHIR BISHT 05914802717 7-C-4

Then click on the Save button .

Output
RUCHIR BISHT 05914802717 7-C-4

6. Function to check if the number is Even or Odd.


Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:

Add a new function , in the general section enter the function name
and comment field is optional so as to describe the function logic or
working.
RUCHIR BISHT 05914802717 7-C-4

Then in the Definition section select the return type , Language and
the function parameters or variables and their data type , default
value , variable name and Mode (IN , OUT , INOUT).
RUCHIR BISHT 05914802717 7-C-4

Then write the Code logic within the Begin and End keywords

Then click on the Save button .


RUCHIR BISHT 05914802717 7-C-4

Output
RUCHIR BISHT 05914802717 7-C-4

Experiment-06
AIM: Write the cursor to increase the marks of student by 10%.
PostgreSQL Cursor
A cursor is a pointer to this context area. PL/SQL controls the context area through a
cursor. A cursor holds the rows (one or more) returned by a SQL statement. The set
of rows the cursor holds is referred to as the active set.
You can name a cursor so that it could be referred to in a program to fetch and
process the rows returned by the SQL statement, one at a time. There are two types of
cursors:
 Implicit cursors
 Explicit cursors
Syntax:
declare
cur_films cursor for
select *
from film;
cur_films2 cursor (year integer) for
select *
from film
where release_year = year;

Function to write the cursor to increase the marks of student by 10%.


Using CLI:
create or replace function modify_marks(s_id integer)
RUCHIR BISHT 05914802717 7-C-4

returns void AS $$
declare
rec_student record;
cur_student cursor(sid integer)
for select marks
from student_marks
where student_marks.s_id = sid;
begin
-- open the cursor
open cur_student(s_id);
loop
fetch cur_student into rec_student;
exit when not found;
Update student_marks
Set marks = rec_student.marks + (rec_student.marks * 10/100)
where current of cur_student;
end loop;
-- close the cursor
close cur_student;
end; $$
language plpgsql;

CREATE OR REPLACE FUNCTION loop_students() returns text AS $$


DECLARE rec RECORD;

BEGIN
FOR rec IN (SELECT * FROM student_marks) LOOP
perform modify_marks(rec.s_id);
RUCHIR BISHT 05914802717 7-C-4

END LOOP;
RETURN 'UPDATED';
END;
$$ LANGUAGE PLPGSQL;
select loop_students();

Before modification:

After modification:

Using GUI:
RUCHIR BISHT 05914802717 7-C-4

Before modification:

After modification:
RUCHIR BISHT 05914802717 7-C-4

Experiment-07
RUCHIR BISHT 05914802717 7-C-4

AIM: Write a program to create exceptions if enrollment no. is not issued to student
by the university and raise the exception explicitly by using raise command.
PostgreSQL Exceptions
When an error occurs in a block, PostgreSQL will abort the execution of the block and
also the surrounding transaction.
To recover from the error, you can use the exception clause in the begin...end block.
Syntax:
<<label>>
declare
begin
statements;
exception
when condition [or condition...] then
handle_exception;
[when condition [or condition...] then
handle_exception;]
[when others then
handle_other_exceptions;
]
end;
Write a program to create exceptions if enrollment no. is not issued to student by
the university and raise the exception explicitly by using raise command.
Using CLI:
do
$$
declare
rec record;
s_name text = 'Ruchir';
begin
select enrollno, students.name
RUCHIR BISHT 05914802717 7-C-4

into strict rec


from students
where students.name = s_name;
-- catch exception
exception
when no_data_found then
raise exception 'student with Name "%" is not assigned', s_name;
end;
$$
language plpgsql;

Output:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:

Student Found:

Student Not Found:


RUCHIR BISHT 05914802717 7-C-4

Experiment-08
AIM
a. Write the procedure to get the average marks of students for branch “CSE”.
b. Write a function that accepts branch and returns the total no. of students of the
branch.
PostgreSQL Procedures
A drawback of user-defined functions is that they cannot execute transactions. In other
words, inside a user-defined function, you cannot start a transaction, and commit or
rollback it. PostgreSQL 11 introduced stored procedures that support transactions.
To define a new stored procedure, you use the create procedure statement.
Syntax:
create [or replace] procedure procedure_name(parameter_list)
language plpgsql
as $$
declare
-- variable declaration
begin
-- stored procedure body
end; $$
PostgreSQL Function
The create function statement allows you to define a new user-defined function.
Syntax:
create [or replace] function function_name(param_list)
returns return_type
language plpgsql
as
$$
declare
-- variable declaration
begin
RUCHIR BISHT 05914802717 7-C-4

-- logic
end;
$$
(A) Write the procedure to get the average marks of students for
branch “CSE”.
Using CLI:
CREATE OR REPLACE PROCEDURE public.avg_marks_of_students(IN
student_branch text, INOUT avg_marks real)
LANGUAGE 'plpgsql'

AS $BODY$
begin
select avg(marks)
into avg_marks
from collegestudents
where branch = student_branch;
end;
$BODY$;
RUCHIR BISHT 05914802717 7-C-4

Using GUI:

(B) Write a function that accepts branch and returns the total no. of
students of the branch.

Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:
RUCHIR BISHT 05914802717 7-C-4

For CSE:

For ECE:

Experiment-09
RUCHIR BISHT 05914802717 7-C-4

AIM
a. Create a trigger on table after inserting a new student into table.
b. Write a row trigger to insert the existing values of the student table into a new
table when the marks of student are updated.
PostgreSQL Trigger
A trigger is a set of actions that are run automatically when a specified change
operation (SQL INSERT, UPDATE, DELETE or TRUNCATE statement) is
performed on a specified table.
Triggers are useful for tasks such as enforcing business rules, validating input data,
and keeping an audit trail.
Syntax:
CREATE [ CONSTRAINT ] TRIGGER name { BEFORE | AFTER | INSTEAD OF }
{ event [ OR ... ] }
ON table_name
[ FROM referenced_table_name ]
[ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE |
INITIALLY DEFERRED } ]
[ FOR [ EACH ] { ROW | STATEMENT } ]
[ WHEN ( condition ) ]
EXECUTE PROCEDURE function_name ( arguments )
(A) Create a trigger on table after inserting a new student into table.
Using CLI:
Trigger:
CREATE TRIGGER ins_same_rec
AFTER INSERT
ON studentinfo
FOR EACH ROW
EXECUTE PROCEDURE rec_insert();
Trigger Function:
CREATE OR REPLACE FUNCTION rec_insert()
RETURNS trigger AS
RUCHIR BISHT 05914802717 7-C-4

$$
BEGIN
INSERT INTO student_added
VALUES(NEW.s_id,NEW.s_name);
RETURN NEW;
END;
$$
LANGUAGE 'plpgsql';

Output:
Before Insertion:

After Insertion:

Using GUI:
Before Insertion:
RUCHIR BISHT 05914802717 7-C-4

After Insertion:

(B) Write a row trigger to insert the existing values of the student table into a
new table when the marks of student are updated.
Using CLI:
RUCHIR BISHT 05914802717 7-C-4

Trigger:
CREATE TRIGGER upd_same_rec
AFTER UPDATE
ON student_marks
FOR EACH ROW
EXECUTE PROCEDURE rec_update();
Trigger Function:
CREATE OR REPLACE FUNCTION rec_update()
RETURNS trigger
LANGUAGE 'plpgsql'
BEGIN
INSERT INTO student_modify
VALUES(Old.s_id,Old.name,Old.marks);
RETURN NEW;
END;
Output:
Before Update:

After Update:
RUCHIR BISHT 05914802717 7-C-4

Using GUI:
Before Update:

After Update:
RUCHIR BISHT 05914802717 7-C-4

***********

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy