0% found this document useful (0 votes)
6 views40 pages

RDBMS Practicals

The document outlines the syllabus and objectives for the RDBMS lab course (CSG151), detailing various experiments related to SQL, including installation, data manipulation, and PL/SQL programming. It specifies the internal and external marks, as well as the expected learning outcomes for each experiment. Additionally, it provides a structured format for lab manuals and evaluation criteria.

Uploaded by

Anish Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views40 pages

RDBMS Practicals

The document outlines the syllabus and objectives for the RDBMS lab course (CSG151), detailing various experiments related to SQL, including installation, data manipulation, and PL/SQL programming. It specifies the internal and external marks, as well as the expected learning outcomes for each experiment. Additionally, it provides a structured format for lab manuals and evaluation criteria.

Uploaded by

Anish Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Annexure A

Syllabus (List of Experiments/Lab Practicals)

Subject:RDBMS lab L T P
Subject Code: CSG151 0 0 2

Internal Marks: 50
External Marks: 50
Total Marks: 100

Sr. No. List of Experiment

Introduction to Structured Query Language (SQL) and installation of


1 Structured Query Language (SQL) Server / Oracle.

Data Types, Creating Tables, Retrieval of Rows using Select Statement,


2 Conditional Retrieval of Rows, Alter and Drop Statements.

Working with Null Values, Matching a Pattern from a Table, Ordering the
3 Result of a Query, Aggregate Functions, Grouping the Result of a Query,
Update and Delete Statements.
Set Operators, Nested Queries, Joins, and Sequences.
4

Views, Indexes, Database Security and Privileges: Grant and Revoke


5 Commands, Commit and Rollback Commands.
PL/SQL (Procedural Language extension to Structured Query Language)
6 Architecture, Assignments and Expressions, Writing PL/SQL ( Procedural
Language extension to Structured Query Language) Code, Referencing
Stored Procedures and Exception Handling.
7

Triggers and Cursor Management in PL/SQL (Procedural Language


8
extension to Structured Query Language).
Annexure C

University School of Computing


Teaching Learning Evaluation Plan

Subject & Subject Code: - Relational Database Management System/CSG151

Objectives of Lab:

 Students will be able to understand installation of Structured Query Language (SQL)


Server / Oracle
 Students will be able to understand Creating Tables, Retrieval of Rows using Select
Statement, Conditional Retrieval of Rows, Alter and Drop Statements
 Student will be able to perform on Ordering the Result of a Query, Aggregate
Functions, Grouping the Result of a Query, Update and Delete Statements
 Student will be able to Understand the concept of Joins, and Sequences IN SQL

Sr.
Expected Learning Apparatus Date of
No Experiment Signature
Outcome Required Experiment
.
Installation of Students will be
Structured Query able to installation
1 Language (SQL) of Structured Query
Server / Oracle. Language (SQL)
Server / Oracle One personal
WAP for Creating Students will be computer
Tables, Retrieval of able to perform (32bit/64 bit,
Rows using Select Creating Tables, 2GB/4GB
Statement, Conditional Retrieval of Rows RAM, 1 GB
Retrieval of Rows, using Select disk space),
2 Alter and Drop Statement, Licensed
Statements. Conditional version of
Retrieval of Rows, window 7,
Alter and Drop Turbo C++
Statements.
.
3 WAP which show Student will be able
Working with Null to perform on
Values, Matching a Ordering the Result
Pattern from a Table, of a Query,
Ordering the Result of Aggregate
a Query, Aggregate Functions, Grouping
Functions, Grouping the Result of a
the Result of a Query, Query, Update and
Update and Delete Delete Statements
Statements.
WAP to show the
working of Set Student will be able
4 Operators, Nested to Joins, and
Queries, Joins, and Sequences
Sequences.
WAP to show the
working of Views, Student will be able
Indexes, Database to PRFORM Grant
Security and and Revoke
5
Privileges: Grant and Commands, Commit
Revoke Commands, and Rollback
Commit and Rollback Commands..
Commands.
WAP to show the
working of PL/SQL
(Procedural Language
extension to Structured
Query Language)
Architecture,
Student will be able
Assignments and
6 to make programs
Expressions, Writing
on Structured Query
PL/SQL ( Procedural
Language
Language extension to
Structured Query
Language) Code,
Referencing Non-
SQL( Structured Query One personal
Language) parameters. computer
WAP to show the (32bit/64 bit,
working of Stored Students will be 2GB/4GB
Procedures and able to create RAM, 1 GB
7 Exception Handling. programs on Stored disk space),
Procedures and Licensed
Exception Handling. version of
window 7,
WAP to show the SQL
working of Triggers Students will be
and Cursor able to perform of
Management in Triggers and Cursor
8
PL/SQL (Procedural Management in
Language extension to PL/SQL (Procedural
Structured Query Language extension
Language).
RDBMS LAB MANNUAL

S.NO EXP NO NAME

1 LAB EXP 1 INTRODUCTION (SQL) AND


INSTALLATION

2 LAB EXP 2 DDL AND DML COMMANDS

3 LAB EXP 3 VARIOUS OPEARTORS IN SQL

4 LAB EXP 4 FUNCTIONS:NUMERIC,STRING


HANDLING,DATE,AGGREGATE

5 LAB EXP 5 VIEWS, INDEXES, TCL COMMANDS


LAB MANUAL FORMAT

1. AIM: Introduction to Structured Query Language (SQL) and installation of


Structured Query Language (SQL) Server / Oracle.

OBJECTIVES: student able to understand the installations steps of SQL.

OUTCOME: student able to perform installation of SQL.

APPARATUS/EQUIPMENTS: SQL SERVER

Total Duration: 110 minutes

Brief Description Experiment to be EVALUATION Remarks If


and Demo conducted by the Any
students Written Verbal Viva
Answer by Explanation
the students by the
students
20 – 30 Minutes 50 -60 Minutes 10 Minutes 5 Minutes 5 Minutes

Introduction:

SQL is a standard language for accessing and manipulating databases.

What is SQL?

 SQL stands for Structured Query Language


 SQL lets you access and manipulate databases
 SQL became a standard of the American National Standards Institute (ANSI) in 1986,
and of the International Organization for Standardization (ISO) in 1987

What Can SQL do?

 SQL can execute queries against a database


 SQL can retrieve data from a database
 SQL can insert records in a database
 SQL can update records in a database
 SQL can delete records from a database
 SQL can create new databases
 SQL can create new tables in a database
 SQL can create stored procedures in a database
 SQL can create views in a database
 SQL can set permissions on tables, procedures, and views
SQL Installation Steps
Step 1− Download the Evaluation Edition
fromhttp://www.microsoft.com/download/en/details.aspx?id=29066

Once the software is downloaded, the following files will be available based on your download
(32 or 64 bit) option.

ENU\x86\SQLFULL_x86_ENU_Core.box

ENU\x86\SQLFULL_x86_ENU_Install.exe

ENU\x86\SQLFULL_x86_ENU_Lang.box

OR

ENU\x86\SQLFULL_x64_ENU_Core.box

ENU\x86\SQLFULL_x64_ENU_Install.exe

ENU\x86\SQLFULL_x64_ENU_Lang.box

Note − X86 (32 bit) and X64 (64 bit)

Step 2− Double-click the “SQLFULL_x86_ENU_Install.exe” or


“SQLFULL_x64_ENU_Install.exe”, it will extract the required files for installation in
the“SQLFULL_x86_ENU” or “SQLFULL_x86_ENU” folder respectively.

Step 3 − Click the “SQLFULL_x86_ENU” or “SQLFULL_x64_ENU_Install.exe” folder and


double-click “SETUP” application.

For understanding, here we have used SQLFULL_x64_ENU_Install.exe software.

Step 4 − Once we click on 'setup' application, the following screen will open.
Step 5 − Click Installation which is on the left side of the above screen.

Step 6 − Click the first option of the right side seen on the above screen. The following screen
will open.
Step 7 − Click OK and the following screen pops up.
Step 8 − Click Next to get the following screen.
Step 9 − Make sure to check the product key selection and click Next.
Step 10 − Select the checkbox to accept the license option and click Next.
Step 11 − Select SQL Server feature installation option and click Next.

Step 12 − Select Database engine services checkbox and click Next.


Step 13 − Enter the named instance (here I used TestInstance) and click Next.
Step 14 − Click Next on the above screen and the following screen appears.

Step 15 − Select service account names and start-up types for the above listed services and click
Collation.
Step 16 − Make sure the correct collation selection is checked and click Next.
Step 17 − Make sure authentication mode selection and administrators are checked and click
Data Directories.
Step 18 − Make sure to select the above directory locations and click Next. The following
screen appears.
Step 19 − Click Next on the above screen.
Step 20 − Click Next on the above screen to the get the following screen.
Step 21 − Make sure to check the above selection correctly and click Install.
Installation is successful as shown in the above screen. Click Close to finish.

2. Aim: write sql ddl and dml commands.

Objectives: student able to understand ddl and dml commands.

Outcome: student perform ddl and dml commands.

Apparatus/equipments: sql server

Total Duration: 110 minutes

Brief Description Experiment to be EVALUATION Remarks If


and Demo conducted by the Any
students Written Verbal Viva
Answer by Explanation
the students by the
students
20-30 Minutes 55-60 Minutes 10 Minutes 5 Minutes 5 Minutes

1. DDL(Data Definition Language) : DDL or Data Definition Language actually consists of


the SQL commands that can be used to define the database schema. It simply deals with
descriptions of the database schema and is used to create and modify the structure of
database objects in database.
Examples of DDL commands:
 CREATE – is used to create the database or its objects (like table, index, function,
views, store procedure and triggers).
 DROP – is used to delete objects from the database.
 ALTER-is used to alter the structure of the database.
 TRUNCATE–is used to remove all records from a table, including all spaces
allocated for the records are removed.
 COMMENT –is used to add comments to the data dictionary.
 RENAME –is used to rename an object existing in the database.
2. DML(Data Manipulation Language) : The SQL commands that deals with the
manipulation of data present in database belong to DML or Data Manipulation Language
and this includes most of the SQL statements.
Examples of DML:
 SELECT – is used to retrieve data from the a database.
 INSERT – is used to insert data into a table.
 UPDATE – is used to update existing data within a table.
 DELETE – is used to delete records from a database table.
3.
Aim: use various opeartors in sql.
Objectives: student able to understand various opeartors in sql.

Outcome: student perform various opeartors in SQL.

Apparatus/equipments: sql server

Total Duration: 110 minutes

Brief Description Experiment to be EVALUATION Remarks If


and Demo conducted by the Any
students Written Verbal Viva
Answer by Explanation
the students by the
students
20-30 Minutes 55-60 Minutes 10 Minutes 5 Minutes 5 Minutes

SQL Arithmetic Operators

Operator Description

+ Add

- Subtract

* Multiply

/ Divide
% Modulo

SQL Bitwise Operators

Operator Description

& Bitwise AND

| Bitwise OR

^ Bitwise exclusive OR

SQL Comparison Operators

Operator Description

= Equal to

> Greater than

< Less than


>= Greater than or equal to

<= Less than or equal to

<> Not equal to

SQL Compound Operators

Operator Description

+= Add equals

-= Subtract equals

*= Multiply equals

/= Divide equals

%= Modulo equals

&= Bitwise AND equals


^-= Bitwise exclusive equals

|*= Bitwise OR equals

SQL Logical Operators

Operator Description

ALL TRUE if all of the subquery values meet the condition

AND TRUE if all the conditions separated by AND is TRUE

ANY TRUE if any of the subquery values meet the condition

BETWEEN TRUE if the operand is within the range of comparisons

EXISTS TRUE if the subquery returns one or more records

IN TRUE if the operand is equal to one of a list of expressions


LIKE TRUE if the operand matches a pattern

NOT Displays a record if the condition(s) is NOT TRUE

OR TRUE if any of the conditions separated by OR is TRUE

SOME TRUE if any of the subquery values meet the condition

4. Aim: Write Functions: Numeric, String Handling, Date And Aggregate Functions
In Sql.
Objectives: Student Able To Understand Functions: Numeric, String Handling, Date,
Aggregate In Sql.

Outcome: Student Able To Perform Functions: Numeric, String Handling, Date, Aggregate
In Sql.

Apparatus/Equipments: Sql Server

Total Duration:110 minutes

Brief Description Experiment to be EVALUATION Remarks If


and Demo conducted by the Any
students Written Verbal Viva
Answer by Explanation
the students by the
students
20-30 Minutes 55-60 Minutes 10 Minutes 5 Minutes 5 Minutes
SQL Server String Functions

Function Description

ASCII Returns the ASCII value for the specific character

CHAR Returns the character based on the ASCII code

CHARINDEX Returns the position of a substring in a string

CONCAT Adds two or more strings together

Concat with + Adds two or more strings together

CONCAT_WS Adds two or more strings together with a separator

DATALENGTH Returns the number of bytes used to represent an expression

DIFFERENCE Compares two SOUNDEX values, and returns an integer value

FORMAT Formats a value with the specified format

LEFT Extracts a number of characters from a string (starting from left)


LEN Returns the length of a string

LOWER Converts a string to lower-case

LTRIM Removes leading spaces from a string

NCHAR Returns the Unicode character based on the number code

PATINDEX Returns the position of a pattern in a string

QUOTENAME Returns a Unicode string with delimiters added to make the string a valid SQ
identifier

REPLACE Replaces all occurrences of a substring within a string, with a new substring

REPLICATE Repeats a string a specified number of times

REVERSE Reverses a string and returns the result

RIGHT Extracts a number of characters from a string (starting from right)


RTRIM Removes trailing spaces from a string

SOUNDEX Returns a four-character code to evaluate the similarity of two strings

SPACE Returns a string of the specified number of space characters

STR Returns a number as string

STUFF Deletes a part of a string and then inserts another part into the string, starting

SUBSTRING Extracts some characters from a string

TRANSLATE Returns the string from the first argument after the characters specified in th
translated into the characters specified in the third argument.

TRIM Removes leading and trailing spaces (or other specified characters) from a st

UNICODE Returns the Unicode value for the first character of the input expression

UPPER Converts a string to upper-case


SQL Server Math/Numeric Functions

Function Description

ABS Returns the absolute value of a number

ACOS Returns the arc cosine of a number

ASIN Returns the arc sine of a number

ATAN Returns the arc tangent of a number

ATN2 Returns the arc tangent of two numbers

AVG Returns the average value of an expression

CEILING Returns the smallest integer value that is >= a number

COUNT Returns the number of records returned by a select query

COS Returns the cosine of a number

COT Returns the cotangent of a number


DEGREES Converts a value in radians to degrees

EXP Returns e raised to the power of a specified number

FLOOR Returns the largest integer value that is <= to a number

LOG Returns the natural logarithm of a number, or the logarithm of a number to a

LOG10 Returns the natural logarithm of a number to base 10

MAX Returns the maximum value in a set of values

MIN Returns the minimum value in a set of values

PI Returns the value of PI

POWER Returns the value of a number raised to the power of another number

RADIANS Converts a degree value into radians

RAND Returns a random number


ROUND Rounds a number to a specified number of decimal places

SIGN Returns the sign of a number

SIN Returns the sine of a number

SQRT Returns the square root of a number

SQUARE Returns the square root of a number

SUM Calculates the sum of a set of values

TAN Returns the tangent of a number

SQL Server Date Functions

Function Description

CURRENT_TIMESTAMP Returns the current date and time

DATEADD Adds a time/date interval to a date and then returns the date
DATEDIFF Returns the difference between two dates

DATEFROMPARTS Returns a date from the specified parts (year, month, and day values)

DATENAME Returns a specified part of a date (as string)

DATEPART Returns a specified part of a date (as integer)

DAY Returns the day of the month for a specified date

GETDATE Returns the current database system date and time

GETUTCDATE Returns the current database system UTC date and time

ISDATE Checks an expression and returns 1 if it is a valid date, otherwise 0

MONTH Returns the month part for a specified date (a number from 1 to 12)

SYSDATETIME Returns the date and time of the SQL Server

YEAR Returns the year part for a specified date


SQL Server Advanced Functions

Function Description

CAST Converts a value (of any type) into a specified datatype

COALESCE Returns the first non-null value in a list

CONVERT Converts a value (of any type) into a specified datatype

CURRENT_USER Returns the name of the current user in the SQL Server database

ISNULL Return a specified value if the expression is NULL, otherwise return the exp

ISNUMERIC Tests whether an expression is numeric

NULLIF Returns NULL if two expressions are equal

SESSION_USER Returns the name of the current user in the SQL Server database

SESSIONPROPERTY Returns the session settings for a specified option

SYSTEM_USER Returns the login name for the current user


USER_NAME Returns the database user name based on the specified id

5. Aim: Views, Indexes, Tcl Commands In Sql?


Objectives: Student Able To Understand Views, Indexes, Tcl Commands.
Outcome: Student Perform Views, Indexes, Tcl Commands.

Apparatus/Equipments: Sql Server

Total Duration: 110 minutes

Brief Description Experiment to be EVALUATION Remarks If


and Demo conducted by the Any
students Written Verbal Viva
Answer by Explanation
the students by the
students
20-30 Minutes 55-60 Minutes 10 Minutes 5 Minutes 5 Minutes

Transaction Control Language(TCL) commands are used to manage transactions in the database.
These are used to manage the changes made to the data in a table by DML statements. It also
allows statements to be grouped together into logical transactions.

COMMIT command
COMMIT command is used to permanently save any transaction into the database.
When we use any DML command like INSERT, UPDATE or DELETE, the changes made by
these commands are not permanent, until the current session is closed, the changes made by
these commands can be rolled back.
To avoid that, we use the COMMIT command to mark the changes as permanent.
Following is commit command's syntax,
COMMIT;

ROLLBACK command
This command restores the database to last commited state. It is also used
with SAVEPOINT command to jump to a savepoint in an ongoing transaction.
If we have used the UPDATE command to make some changes into the database, and realise that
those changes were not required, then we can use the ROLLBACK command to rollback those
changes, if they were not commited using the COMMIT command.
Following is rollback command's syntax,
ROLLBACK TO savepoint_name;

SAVEPOINT command
SAVEPOINT command is used to temporarily save a transaction so that you can rollback to that
point whenever required.
Following is savepoint command's syntax,
SAVEPOINT savepoint_name;
In short, using this command we can name the different states of our data in any table and then
rollback to that state using the ROLLBACK command whenever required.

Using Savepoint and Rollback


Following is the table class,

id name

1 Abhi

2 Adam

4 Alex

Lets use some SQL queries on the above table and see the results.
INSERT INTO class VALUES(5, 'Rahul');

COMMIT;

UPDATE class SET name = 'Abhijit' WHERE id = '5';

SAVEPOINT A;

INSERT INTO class VALUES(6, 'Chris');

SAVEPOINT B;
INSERT INTO class VALUES(7, 'Bravo');

SAVEPOINT C;

SELECT * FROM class;


NOTE: SELECT statement is used to show the data stored in the table.

The resultant table will look like,

id name

1 Abhi

2 Adam

4 Alex

5 Abhijit

6 Chris

7 Bravo

Now let's use the ROLLBACK command to roll back the state of data to the savepoint B.
ROLLBACK TO B;

SELECT * FROM class;


Now our class table will look like,

id name

1 Abhi
2 Adam

4 Alex

5 Abhijit

6 Chris

Now let's again use the ROLLBACK command to roll back the state of data to the savepoint A
ROLLBACK TO A;

SELECT * FROM class;


Now the table will look like,

id name

1 Abhi

2 Adam

4 Alex

5 Abhijit

So now you know how the commands COMMIT, ROLLBACK and SAVEPOINT works.

You might also like