Jyot DBMS
Jyot DBMS
CERTIFICATE
This is to certify that the work entered in this laboratory journal is the work of
Ms. /Mr. Jyot Patel of 2nd Year CSE., Discipline B-Tech CSE, Enrollment No. 20BT04035
and has satisfactorily completed the required number of experiments for the 4th Semester,
Academic Year Jan – 2022 in the CSE Laboratory as laid down by the University.
PREFACE
Computer science and engineering is a branch of engineering that
integrates several fields of computer science and electronic engineering required
to develop computer hardware and software.. Thus, it is important that students
of Computer science and engineering perform experiments in the laboratory to
gain insights and develop understanding of the theories underlying various
phenomenons. Laboratory experimentation allows students the opportunity to
develop techniques and other manipulative skills that students of
engineering must master.
GSFC University understands the importance of laboratory work in the study of
Computer science and engineering. The institute is committed to this component
of your education and hopes that you will take full advantage of this opportunity
to explore the Computer science and engineering.
This laboratory manual is not only a source to enhance your understanding of
Computer science and engineering, but also to utilize, analyze and interpret the
experimental data. It is important that you carefully prepare for each experiment
by reading the related text material before coming to the laboratory in order to
maximize the laboratory experience.
A unique aspect of this laboratory program is that a concerted effort has
been made to use of different language in concept of computer science and
engineering in the experiments. The aim is to not only teach students but also to
lessen the impact of this program upon the real time application. This manual is
free for non–commercial use. All rights reserved. This is brought to you by GSFC
University. It is the user’s responsibility to ensure that proper supervision is
maintained at all times by an appropriately trained person or persons to ensure
the safety of all people using any of the experiments contained in this manual.
Finally, we hope you find this laboratory manual helpful in study of Computer
science and engineering.
Practical-1
Aim:- Create Database using SQL command line.
Description: - In this, we have to make a table using SQL command Line.
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Implementation: - First we have to download the Oracle XE 11g version then install it. When you
install in that you have to enter password. This password is remember for the further work. When
your Installation completed then you have to just open SQL command line then simply written
command “conn sys as sysdba” then enter your password(jyotnpatel) which you have entered in
installation. After this you connected with your database. As you can see in the Fig-1.1. After the
connected with database simply do create table in command. And write query for creating table for
DEPOSIT. As you can seen in Fig-1.2. After that you can create BRANCH, CUSTOMERS, BORROW as
you can seen in Fig-1.3, Fig-1.4, Fig-1.5.
SCREENSHOTS
Fig-1.1
Fig-1.2
Fig-1.3
Fig-1.4
Fig-1.5
Fig-1.6
Fig-1.7
Fig-1.8
Fig-1.9
Practical-2
Aim:- Insert given data in database table.
Description: - In this, we have to insert the given data in the previously made tables .
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Implementation: -First connect your database and then open the previously created table and now
run insert query to insert the given data . As you can see in the Fig-1.1. has insert query for deposit
data and inserted values shown in table.
Fig-1.2 has insert query for branch data and inserted values shown in table.
Fig-1.3 and 1.4 has inserte query for customer data and inserted values shown in table.
Fig-1.5 has insert query for borrow and inserted values shown in table.
Screenshots
Fig-1.1
Fig-1.2
Fig-1.3
Fig-1.4
Practical-3
Aim:- Demonstrate use of DDL commands with an appropriate example of applying it on a
table.
Description: - Explain use of following DDL commands.
1) Create
2) Alter
3) Truncate
4) Rename
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Implementation: -
First we have to connect to conn system and using create query table will be created
as shown in fig-3.1.
If you want to create table and same structure as you make in previous table then simply
you have to written another create query as shown in Fig-3.2.
Now if you want to create table as you make in previous table and you want only some
specific columns then you have to written also another create query as shown in Fig-3.3.
So first in alter we add one specific column as shown in Fig-3.4. After that you can remove or
drop specific column in table as shown in Fig-3.5.
Now let’s go the fourth command that is TRUNCATE. In this let’s take some data and when
you use truncate it removes all rows from an existing table as shown in Fig-3.6. You can also
use DROP TABLE command to delete complete table but it would remove complete table
structure from the database.
Now let’s go the fifth command that is RENAME. In this we can change table name using two
methods, first is using alter command and second is RENAME command.
First, we will take alter command for changing table name as shown in Fig-3.7.
Second, we will take RENAME command for changing table name as shown in Fig-3.8.
Fig-3.1
Fig-3.2
Fig-3.3
Fig-3.4
Fig-3.5
Fig-3.6
Fig-3.7
Fig-3.8
Practical-4
Aim:- Describe use of following SQL constraint by applying it on appropriate table. 1) Not Null 2)
Unique
Description: - In this we have to perform constraint in SQL Command line. Prerequisites: - In this, we
have some knowledge about SQL and query syntaxes.
Implementation: -
In this practical we have to do make connection in system using ‘conn system’. In this we have
to first we perform Not Null constraint in employees table in firstname column as shown in Fig-
4.1.
After that as you can see in Fig-4.2 first is inserted values and in second run insert query. For
define Not Null simply using NULL .
Second is Unique for that as you can see in the Fig-4.3, I have added Unique first give
constraint in email. As you can see in Fig-4.3. constraint violated.
Next I remove the constraint in email. After that I’ll take two constraint in one query that is
email and firstname as shown in Fig-4.4. After that inserted one data. In Fig-4.5 as you can see,
if we inserted same first and email then it will be violated Unique constraint.
Screenshots:
Fig-4.1
Fig-4.2
Fig-4.3
Fig-4.4
Fig-4.5
Practical – 5
Aim: - Describe use of following SQL constraint by applying it on appropriate table.
1) Check
2) Primary Key
Description: - In this we have to perform constraint in SQL Command line.
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Screenshots
1. Check
2. Primary key
Practic-6
Aim:- Demonstrate use of DDL commands with an appropriate example of applying it on a table.
Explain use of following DDL commands.
1) Foregin Key
2) Insert (Syntax to insert of specific number of columns, making script out of insert statement to
insert values)
Description: - In this we have to perform constraint in SQL Command line regarding DDL.
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Screenshots
2. Insert(unique)
Practical-7
Aim:- Describe use of following DDL and DML commands with appropriate example.
1) Update
2) Delete
3) Drop
4) Truncate
5) Merge
Description: - In this we have to perform constraint in SQL Command line regarding DDL & DML.
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
TRUNCATE TABLE - deletes the data inside a table, but not the table itself.
Screenshots
1.Update
Before update
After update
2.Delete
3.Turncate
4.Drop Table
Practical-8
2. Savepoint
3. Rollback
Screenshots
1.create:
2.Savepoint: 3.Rollback:
Practical-9
Aim:- Describe use of following DDL and DML commands with appropriate example.
1) Character Function
2) Number Function
3) Date Function
Description: - In this we have to perform constraint in SQL Command line regarding DDL & DML.
Prerequisites: - In this, we have some knowledge about SQL and query syntaxes.
Screenshots
1. Character
2. Number
3. Date
Practical-10 - A
Aim:- Describe various options available with Oracle Date SQL Functions with appropriate example.
Description: - In this we have to perform constraint in SQL Command line regarding SQL.
Prerequisites: -
Next, we select the data to find out which employee joined at which day using
WHERE clause .
As shown in Fig-10.3 TO_CHAR (SYSDATE, ‘dd mon yy’) : In this function print date,
month in the short-form and year.
Another is TO_CHAR(SYSDATE, ‘DL’) : it will print day , month, date, year in long
format.
Screenshots :
Practical-10 - B
Aim:- Describe use of null values handling oracle SQL Functions , SQL views creating users and DCL
Description: - In this we have to create new user and DCL commands with appropriate eg.
Screenshots
10.1
10.2
10.3
Practical – 11
Aim:- Demonstrate the use of Oracle and SQL Joins with appropriate examples
Description: - In this we have to perform constraint in SQL Command line regarding Oracle.
Prerequisites: -
1. INNER JOIN:
The INNER JOIN keyword selects record that have matching values in
both tables.
2. LEFT JOIN:
The LEFT JOIN keyword returns all records from the left table, and the
matching records from the right table. The result is 0 records from the right side, if
there is no match.
3. RIGHT JOIN:
The RIGHT JOIN keyword returns all records from the right table
(table2), and the matching records from the left table (table1). The result is 0 records
from the left side, if there is no match.
4. FULL JOIN:
The FULL OUTER JOIN keyword returns all records when there is a match
in left (table1) or right (table2) table records.
5. SELF JOIN:
A self-join is a regular join, but the table is joined with itself.
Screenshots:
Practical – 12
Aim: Create and execute a TRIGGER, PROCEDURE and FUNCTION on a table in SQL.
Screenshots
Practical – 13
Aim : Demonstrate the concept of SUBQUERY in SQL.
Screenshots