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

Database Systems

This document contains a summary of database systems practical assignments completed by a student. It includes 13 practical assignments on topics like SQL commands, constraints, joins, views, PL/SQL basics, procedures and functions. For each practical, it lists the tasks completed and provides examples of SQL or PL/SQL code used along with the results. The document was submitted by Om Singh for their database systems practical file.

Uploaded by

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

Database Systems

This document contains a summary of database systems practical assignments completed by a student. It includes 13 practical assignments on topics like SQL commands, constraints, joins, views, PL/SQL basics, procedures and functions. For each practical, it lists the tasks completed and provides examples of SQL or PL/SQL code used along with the results. The document was submitted by Om Singh for their database systems practical file.

Uploaded by

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

Database

Systems
Practical File

Submitted By:Om singh


Roll No.: UE213065
CSE Section 2 Group 4
2|Page

Index
Practical 1: Introductory Lab and Implementation of DDL, DML
Commands 3
Practical 2: To Implement the Usage of Constraints in SQL 13
Practical 3: To Implement the Usage of Clauses, Aggregate
Functions, Set Operations and Pattern Matching in SQL. 16
Practical 4: Implement the Usage of Joins, Nested Queries and
Sequences in SQL 20
Practical 5: Using Views in SQL 23
Practical 6: Introduction to PL/SQL 25
Practical 7: Using Procedures and Functions in PL/SQL 28
Practical 8: Reversing a Number in PL/SQL 30
Practical 9: Using Cursors in PL/SQL 31
3|Page

Practical 1: Introductory Lab and


Implementation of DDL, DML Commands
 Database Management System
Database Management System, or DBMS, is a software which is used to create, edit,
and maintain database files and records, enabling easier file and record creation,
data entry, data editing, updating, and reporting. This software also handles data
storage, backup and reporting, multi-access control, and security. Some examples of
popular database software or DBMSs include MySQL, Microsoft Access, Microsoft
SQL Server, and Oracle Database.

 SQL
SQL stands for Structured Query Language. SQL is a programming language used by
nearly all relational databases to query, manipulate, and define data, and to provide
access control.

Signing Up for Oracle APEX Workspace:


1. Go to https://apex.oracle.com.
2. Click Get Started for Free.

3. Scroll down until you see details for apex.oracle.com. Click Request a Free
Workspace.
4|Page
5|Page

4. On the Request a Workspace dialog, enter your Identification details – First Name,
Last Name, Email, Workspace. Note: For workspace, enter a unique name, such as
first initial and last name or roll number.

5. Complete the remaining setup steps.


6. Check your email. You should get an email within a few minutes.
7. Within the email body, click Create Workspace.
8. Click Continue to Sign in Screen.
9. Enter your password, and click Apply Changes.
6|Page

10. You should now be in the APEX Builder.


7|Page

Using SQL Queries to Manage Database:


1. Creating a Table
o Query:

o Result: Table Created.

2. Creating a Table from Another Table:


o Query:

o Result: Table Created.

3. Insertion of Data into Table:


o Queries:

o Result: 1 row(s) inserted. (Per Query).


8|Page

4. Inserting Data into a Table from Another Table:


o Query:

o Result: 5 row(s) inserted.

5. Insertion of Selected Data into a Table from Another Table:


o Query:

o Result: 4 row(s) inserted.

6. Describe the Structure of the Table:


o Query:
9|Page

o Result:

7. Retrieving Data from the Table:


o Query:

o Result:

8. Retrieving Specific Columns from a Table:


o Query:

o Result:
10 | P a g e

9. Elimination of Duplicates from the SELECT Statement.


o Query:

o Result:

10. Selecting a Dataset from Table Data


o Query:

o Result:

11. Updating the Content in the Table:


o Query:

o Result:
11 | P a g e

12. Deletion of all Rows:


o Query:

o Result: 4 row(s) Deleted.

13. Deletion of Specified Number of Rows:


o Query:

o Result: 1 row(s) deleted.

14. Add a new Column:


o Query:

o Result: Table altered.


12 | P a g e

15. Modify Existing Columns:


o Query:

o Result: Table altered.

16. Renaming a Column:


o Query:

o Result: Table altered.

17. Dropping a Column from a Table:


o Query:

o Result: Table altered.


13 | P a g e

18. Renaming the Table:


o Query:

o Result: Statement processed.

19. Dropping a Table:


o Query:

o Result: Table dropped.


14 | P a g e

Practical 2: To Implement the


Usage of Constraints in SQL
1. Creating Constraints in CREATE TABLE Command:
o Query:

o Result:

2. Adding Primary Key Constraint using ALTER TABLE Command:


o Query:

o Result:

3. Dropping Primary Key Constraint:


o Query:

o Result:
Table Altered.
15 | P a g e

4. Adding Unique Constraint Using ALTER TABLE:


o Query:

o Result:
Table Altered.

5. Dropping Unique Constraint:


o Query:

o Result:
Table Altered.

6. Adding NOT NULL Constraint Using ALTER TABLE:


o Query:

o Result:

7. Dropping NOT NULL Constraint:


o Query:

o Result:
16 | P a g e

8. Adding Check Constraint Using ALTER TABLE:


o Query:

o Result:
Table Altered.

9. Dropping Check Constraint:


o Query:

o Result:
Table Altered.
17 | P a g e

Practical 3: To Implement the Usage of


Clauses, Aggregate Functions, Set
Operations and Pattern Matching in SQL.

1. Using WHERE Clause:


o Query:

o Result:

2. Using GROUP BY Clause and COUNT Aggregate Function:


o Query:

o Result:

3. Using ORDER BY Clause:


o Query:

o Result:
18 | P a g e

4. Using AVG() Aggregate Function:


o Query:

o Result:

5. Using MIN() Aggregate Function:


o Query:

o Result:

6. Using MAX() Aggregate Function:


o Query:

o Result:

7. Using SUM() Aggregate Function:


o Query:
19 | P a g e

o Result:

8. Using UNION Operator:


o Query:

o Result:

9. Using UNION ALL Operator:


o Query:

o Result:
20 | P a g e

10. Using INTERSECT Operator:


o Query:

o Result:

11. Using MINUS Operator:


o Query:

o Result:

12. Pattern Matching Using LIKE Operator and Wildcards:


o Query:
21 | P a g e

o Result:

13. Using BETWEEN Operator:


o Query:

o Result:
22 | P a g e

Practical 4: Implement the Usage of


Joins, Nested Queries and Sequences in
SQL

1. Using INNER JOIN:


o Query:

o Result:

2. Using LEFT JOIN:


o Query:

o Result:

3. Using RIGHT JOIN:


o Query:

o Result:
23 | P a g e

4. Using FULL OUTER JOIN:


o Query:

o Result:

5. Implementing Self Join:


o Query:

o Result:

6. Using Nested Queries:


o Query:

o Result:
24 | P a g e

7. Creating Sequence:
o Query:

o Result:
Sequence created.

8. Creating Cyclic Sequence:


o Query:

o Result:
Sequence created.

9. Altering a Sequence:
o Query:

o Result:
Sequence altered.

10. Using Sequences in INSERT Statement:


o Query:

o Result:

11. Dropping a Sequence:


o Query:

o Result:
Sequence dropped.
25 | P a g e

Practical 5: Using Views in SQL


1. Creating a View:
o Query:

o Result:

2. Creating a View from more than one tables:


o Query:

o Result:

3. Retrieving Data from a View:


o Query:

o Result:
26 | P a g e

4. Inserting Data into a View:


o Query:

o Result:
1 row(s) inserted.

5. Updating Data in a View:


o Query:

o Result:
1 row(s) updated.

6. Deleting Data from a View:


o Query:

o Result:
1 row(s) deleted.

7. Renaming a View:
o Query:

o Result:
Statement processed.

8. Dropping a View:
o Query:

o Result:
View dropped.
27 | P a g e

Practical 6: Introduction to
PL/SQL
1. Creating a PL/SQL Block:
o Code:

o Result:
Hello!

2. Using SELECT INTO statement in PL/SQL:


o Code:

o Result:
Hello, Kritika!

3. Taking Inputs from Users in PL/SQL:


o Code:

o Result:

Hello, Madhur!
28 | P a g e

4. Manipulating Table Data in PL/SQL:


o Code:

o Result:

Values inserted successfully


1 row(s) inserted.

5. Using Conditional Statement in PL/SQL:


o Code:

o Result:

Larger number is 34
29 | P a g e

6. Using Loops in PL/SQL:


o Code:

o Result:

Factorial = 120
30 | P a g e

Practical 7: Using Procedures and


Functions in PL/SQL
1. Creating Procedures in PL/SQL:
o Code:

o Result:
Procedure created.

2. Using Procedures in PL/SQL:


o Code:

o Result:

Factorial = 120
31 | P a g e

3. Creating Functions in PL/SQL:


o Code:

o Result:
Function created.

4. Using Functions in PL/SQL:


o Code:

o Result:
Factorial is 120
32 | P a g e

Practical 8: Reversing a Number


in PL/SQL
1. Using a Procedure:
o Code:

o Result:

Reversed number = 54321

2. Using a Function:
o Code:

o Result:
33 | P a g e

Reversed number = 54321

Practical 9: Using Cursors in


PL/SQL
1. Using Implicit Cursors in PL/SQL:
o Code:

o Result:

No of rows deleted = 1

2. Using Explicit Cursors in PL/SQL:


o Code:

o Result:
Salary of JONES = 2975
Salary of SCOTT = 3000
Salary of FORD = 3000
Salary of SMITH = 800
Salary of ADAMS = 1100
34 | P a g e

You might also like