0% found this document useful (0 votes)
126 views9 pages

DBMS Worksheet 1 (8 Files Merged)

The document summarizes an experiment on introducing basic concepts of databases and SQL commands. It describes creating a table using SQL commands like CREATE TABLE and inserting data using INSERT. It also covers retrieving and modifying data using SELECT, UPDATE, and DELETE statements with different conditions. Various SQL commands were implemented successfully in an Oracle software and screenshots were provided. The key learning was creating and manipulating data in tables using SQL statements.

Uploaded by

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

DBMS Worksheet 1 (8 Files Merged)

The document summarizes an experiment on introducing basic concepts of databases and SQL commands. It describes creating a table using SQL commands like CREATE TABLE and inserting data using INSERT. It also covers retrieving and modifying data using SELECT, UPDATE, and DELETE statements with different conditions. Various SQL commands were implemented successfully in an Oracle software and screenshots were provided. The key learning was creating and manipulating data in tables using SQL statements.

Uploaded by

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

Experiment – 1

Student Name: Garv Kathuria UID: 21BCS5819


Branch: CSE – AIML Section/Group: 21AML – 4 (B)
Semester: 3nd Semester Date of Performance: 23/08/2022
Subject Name: DBMS Subject Code: 21CSH-243
c. Use clear screen; command to clear the screen.
1. Experiment Title/Problem Statement:

Introduction to DBMS, RDBMS and SQL Commands

2. Requirements:

Basic knowledge about Oracle and SQL


Software: Oracle 10g and Run SQL Command Line

3. Description:
d. Output of the clear screen; command depicted in the following snapshot.
Implement 5 commands of Oracle in Run SQL Command Line software.

4. Steps for experiment/practical (with Snapshots):

To start the software, follow the given steps –

a. Write CONNECT on the blank screen.

b. Then enter the username and password. If the password is correct, it will show connected.
e. Use Select * from tab; command to view the system tables.

b. Use Insert command to add data into the table.

c. Select statement is used to retrieve the data of the table.

To create a table, follow the given steps –

a. Use CREATE TABLE command to create a table.

d. Use to commit command to permanent all the changes made to the database.
Experiment No. – 1.2

Student Name: Garv Kathuria UID: 21BCS5819


Branch: CSE-AIML Section/Group: 21AML-4B
Semester: 3rd Date of Performance: 02/09/2022
Subject Name: DBMS Subject Code: 21CSH-243

1. Aim/Overview of the practical:


Create Tables and Specify Queries in SQL

2. Task to be done: using basic commands of DML, DDL.

3. SQL Commands:

-> create database data;


->use data;
->create table employee(emp_id int primary key,name char(20),
5. Result/Output/Writing Summary: -> salary int,
-> position char(20),
The software was successfully started and a table was created using the various commands in -> address char(20));
the database. > insert into employee value(1,"sam",10000,"clerk","mumbai");
> insert into employee value(2,"jack",50000,"manager","punjab");
> insert into employee value(3,"mack",30000,"executive officer","punjab");
> insert into employee value(4,"samantha",35000,"team leader","UP");
6. Graphs (If Any): N/A > insert into employee value(5,"alex",40000,"idea generator","tamil nadu");
> select * from employee;
> select name,position from employee;
> select name,position from employee where salary>20000;
> select distinct address from employee;
> select * from employee where salary>20000 and address="punjab";
> select * from employee where salary>40000 or address="mumbai";
> select * from employee where not position='manager';
> update employee set name='abdul', address='rajastan' where emp_id=3;
>delete from employee where emp_id=5;

4.Screenshots
5. Result/Output/Writing Summary:

The code runs perfectly also the table is created successfully the changes applied to the table are
seen in the select statement.

Experiment No. – 1.3


Learning outcomes (What I have learnt):
Student Name: Garv Kathuria UID: 21BCS5819
1. Learnt to create table using SQL. Branch: CSE-AIML Section/Group: 21AML-4B
Semester: 3rd Date of Performance: 02/09/2022
2. Learnt to work with select commands with different condition.
Subject Name: DBMS Subject Code: 21CSH-243
3. Learnt to modify, update and deleted values in a table.
1. Aim/Overview of the practical:
Create Tables and Specify Queries in SQL
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):
2. Task to be done: using basic commands of DML, DDL.
Sr. No. Parameters Marks Obtained Maximum Marks
1. 3. SQL Commands:
2.
3. -> create database data;
->use data;
->create table employee(emp_id int primary key,name char(20),
-> salary int,
-> position char(20),
-> address char(20));
> insert into employee value(1,"sam",10000,"clerk","mumbai");
> insert into employee value(2,"jack",50000,"manager","punjab");
> insert into employee value(3,"mack",30000,"executive officer","punjab");
> insert into employee value(4,"samantha",35000,"team leader","UP");
> insert into employee value(5,"alex",40000,"idea generator","tamil nadu");
> select * from employee;
> select name,position from employee;
> select name,position from employee where salary>20000;
> select distinct address from employee;
> select * from employee where salary>20000 and address="punjab";
> select * from employee where salary>40000 or address="mumbai";
> select * from employee where not position='manager';
> update employee set name='abdul', address='rajastan' where emp_id=3;
>delete from employee where emp_id=5;

4.Screenshots
5. Result/Output/Writing Summary:

The code runs perfectly also the table is created successfully the changes applied to the table are
seen in the select statement.
Learning outcomes (What I have learnt): EXPERIMENT-1.5
1. Learnt to create table using SQL.
Student Name: Garv Kathuria UID: 21BCS5819
2. Learnt to work with select commands with different condition. Branch: AIML Section/Group- 21AIML-4-B
Semester: 3rd Date of Performance:30/09/22
3. Learnt to modify, update and deleted values in a table. Subject Name: Database Management System Subject Code: 21CSH-243

Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):
1. Experiment Title/Problem Statement:
Sr. No. Parameters Marks Obtained Maximum Marks
1. To implement the structure of table.
2.
3. 2. Requirements: Oracle express edition 11g software

3. Description-
Data Definition language (DDL)- It 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 alter the structure of database objects in the
database. It is a set of SQL commands that is used to modify, alter, and delete
database structure or schema.

DDL include the following the SQL statements:


 Create - This command is used to create the database or its objects (like table,
index, function, views, store procedure, and triggers).
 Alter - This is used to alter the structure of the database. Various use of alter
command are, to add, rename, drop, modify a column.
 Truncate - This is used to remove all records from a table, including all spaces
allocated for the records are removed. But this command will not destroy the
table structure.
 Drop - This command completely removes a table from database.
 Rename - This is used to rename an object existing in the database.
 Comment - This is used to add comments to the data dictionary.

4. Steps for experiment/practical:


1. Create table train with 3 columns (Train_name, train_no, class).
2. Use alter command to add a column (name) and using same command add 2
columns (age, gender).

3. Use desc command to show the description of table.


4. Use alter command to rename column name class to type.
5. Use alter command to modify the datatype of gender column to varchar2.
6. Use drop command to remove the column train_name.
7. Insert the values to table using insert command.
8. Remove all the data from table using truncate command.
9. Destroy the table train using drop command.
10. Using rename command rename the table name train5 to train_ticket.

5. Snapshots of Above steps


 Alter command

 Truncate command

 Drop command
6. Result/Output/Writing Summary:

Above constraints are executed successfully in SQL command line

 Rename command:

 Comment:

Student Name: Garv Kathuria UID: 21BCS5819 Here, we are implementing all the joins on a pair of tables having single column but the
functionality of join is not limited to two tables or single column only but it can be used
Branch: AIML Section/Group- 21AIML-4-B
with various columns & even more columns.
Semester: 3rd Date of Performance:
Subject Name: Database Management System Subject Code: 21CSH-243 4. Steps for experiment/practical:
1. Create table tab1 and tab2 with 1 column val and insert the values.
2. Perform NON-EQUI join in tab1 and tab2 using != operator.
3. Perform EQUI join in tab1 and tab2 using = operator.
1. Experiment Title/Problem Statement: 4. Perform both right and left outer join in tab1 and tab2 using (+) operator.
5. Create another table student with column name and age and insert values to it.
To implement the concept of joins. 6. Perform greater than operation and grouping the data using age column.

5. Snapshots of Above steps


2. Requirements: Oracle express edition 11g software
 Creating table and inserting values:
3. Description-
In this experiment, we will be looking at the various joins present in the SQL for combining
rows from two or more tables. Join clause combines data from various tables on the base
of a common field (columns). A few JOINs are discussed below with their respective syntax:

1. EQUI JOIN: This join statement is used for joining two tables with the help of
equality or matching columns, i.e., the equal rows from both of the tables will be
combined. It is also called as Simple Join.
SYNTAX: SELECT <columns> FROM <tbl1>, <tbl2> WHERE tbl1.<col> =
tbl2.<col>;
2. NON-EQUI JOIN: This join relies on relations other than equality ranging from
<, >, <=, >= or !=. It returns the combination for the rows pertaining to the
columns based on the given relation.
SYNTAX: SELECT <col> FROM <tbl1>, <tbl2> WHERE tbl1.col > tbl2.col;
3. OUTER JOIN: It is of two types, right & left. It is a superset of Equi-join which
returns the rows as per simple join along with no matching rows corresponding
to a particular column. It is represented using ‘(+)’ with the table name.
● If the operator is on the left side, then it is RIGHT OUTER JOIN which
results in the extra values from the right table to be taken.
SYNTAX: SELCT * FROM tbl1, tbl2 WHERE tbl1.col1 (+) = tbl2.col2;
● If the operator is on the right side, then it is LEFT OUTER JOIN which
results in the extra values from the left table to be taken.
SYNTAX: SELCT * FROM tbl1, tbl2 WHERE tbl1.col1= tbl2.col2 (+);
 NON-EQUI join  Outer joins:

 Creating table and inserting values:

 EQUI join

 Using greater than relation:

Student Name: Garv Kathuria UID: 21BCS5819


Branch: AIML Section/Group- 21AIML-4-B
Semester: 3rd Date of Performance:
Subject Name: Database Management System Subject Code: 21CSH-243

1. Experiment Title/Problem Statement:

To implement the concept of grouping of data

2. Requirements: Oracle express edition 11g software

3. Description-
GROUP by-The GROUP BY Statement in SQL is used to arrange identical data
into groups with the help of some functions. i.e if a particular column has same
values in different rows then it will arrange these rows in a group.
6. Result/Output/Writing Summary:
HAVING Clause- it enables you to specify conditions that filter which group
The different types of joins present in the SQL were understood & implemented results appear in the results.
successfully in this experiment. The WHERE clause places conditions on the selected columns, whereas the
HAVING clause places conditions on groups created by the GROUP BY clause.

ORDER by- The SQL ORDER BY clause is used to sort the data in ascending or
descending order, based on one or more columns
4. Steps for experiment/practical: Groupby with where and without where
1. Create table tbl2 with 3 column (name, age, marks).
2. Insert values in it
3. Use group by clause with where and without where
4. Use having clause with group by
5. Use order by clause with group by
5. Snapshots of Above steps

Using having clause

Using order by clause

6. Result/Output/Writing Summary:

Above clauses are executed successfully in SQL command line

Student Name: Garv Kathuria UID: 21BCS5819 .

Branch: AIML Section/Group- 21AIML-4-B 4. Steps for experiment/practical:


Semester: 3rd Date of Performance:
1. Create table tbl_stu with 2 columns(name, age) and insert the values.
Subject Name: Database Management System Subject Code: 21CSH-243 2. Apply single and multiple row sub query on the table.
3. Perform any operator in tbl_stu.
4. Perform exists operator in tbl_stu.
5. Perform like operator in tbl_stu.
1. Experiment Title/Problem Statement:
5. Snapshots of Above steps
To implement the concept of sub query.
 Creating table and inserting values:
2. Requirements: Oracle express edition 11g software

3. Description-
A subquery is a query within another query. The outer query is known as the main query,
and the inner query is known as a subquery.
Subqueries with the Select Statement – SQL subqueries are most frequently used with the
Select statement.
Syntax –
SELECT column_name
FROM table_name
WHERE column_name expression operator
SELECT column_name from table_name WHERE ...);
The list of logical operators in SQL are as follows:
Operator Description
All It compares a value to all values in another value set.
And It allows the existence of multiple conditions in an SQL statement.
Any It compares the values in the list according to the condition.
It is used to search for values that are within a set of values.
Between
In It compares a value to that specified list value.
Not It reverses the meaning of any logical operator.
Or It combines multiple conditions in SQL statements.
Exists It is used to search for the presence of a row in a specified table.
Like It compares a value to similar values using wildcard operator
Student Name: Garv Kathuria UID: 21BCS5819
Branch: AIML Section/Group- 21AIML-4-B
Semester: 3rd Date of Performance:
Subject Name: Database Management System Subject Code: 21CSH-243

1. Experiment Title/Problem Statement:

To implement the concept of index, cursors, triggers, and view

2. Requirements: Oracle express edition 11g software

3. Description-
Index-Indexes are used to retrieve data from the database more quickly than
otherwise. The users cannot see the indexes, they are just used to speed up
searches/queries.

Cursor- A cursor is a pointer to this context area. PL/SQL controls the context
area through a cursor.

Triggers- Triggers are stored programs, which are automatically executed or fired
when some events occur.

View- A view contains rows and columns, just like a real table. The fields in a
view are fields from one or more real tables in the database.

4. Steps for experiment/practical:

6. Result/Output/Writing Summary: 1. Open SQL command line.


2. Write connect then enter username and password.
The concept of sub queries and logical operators was successfully implemented on the 3. Create index index_tbl1 on tbl1(name)
tables.

4. Create index uniqueindex_tbl1 on tbl1(marks)


5. Drop both index
6. Create view viewtbl1 from tbl1
7. Create view view2tbl1 from tbl1(name,marks)
8. Drop view
5. Snapshots of Above steps View
Index

6. Result/Output/Writing Summary:

Implementation of index ,view, triggers, and cursors.

You might also like