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

DMS Project (Execute Queries Using SELECT - Command With WHERE and HAVING Clause)

The document describes a micro-project on executing SQL queries using the SELECT command with the WHERE and HAVING clauses. The project was carried out by a team of 4 students. They created two database tables, inserted data, and ran queries to filter the results based on conditions. The queries demonstrated the use of the WHERE clause to filter rows and the HAVING clause to filter groups of aggregated data. The project helped develop skills in using core SQL features and managing relational databases.

Uploaded by

shubham
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)
97 views

DMS Project (Execute Queries Using SELECT - Command With WHERE and HAVING Clause)

The document describes a micro-project on executing SQL queries using the SELECT command with the WHERE and HAVING clauses. The project was carried out by a team of 4 students. They created two database tables, inserted data, and ran queries to filter the results based on conditions. The queries demonstrated the use of the WHERE clause to filter rows and the HAVING clause to filter groups of aggregated data. The project helped develop skills in using core SQL features and managing relational databases.

Uploaded by

shubham
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/ 8

Annexure II

Annexure-II

Second Year Computer Engineering

DATABASE MANAGEMENT SYSTEM


(22319)

Micro-Project

Topic - Execute queries using SELECT


command with WHERE and HAVING clause

Team Members:
Om Ghugare (30)
Abhishek Chaudhari (31)
Suyash Nangare (32)
Rohan Khachane (33)

DATABASE MANAGEMENT SYSTEM Page


Annexure II

Micro-Project Proposal
Execute queries using SELECT command with WHERE and HAVING clause:

1.0 Rationale

Database Management Systems (DBMS) are vital components of modern information systems.
Database applications are pervasive and range in size from small in-memory databases to terra
bytes or even larger in various applications domains. The course focuses on the fundamentals of
knowledgebase and relational database management systems, and the current developments in
database theory and their practice.

2.0 Aim Of Micro-Project


Creating a database with two tables holding specific data in its tuples. Executing
queries with the use of SELECT command with WHERE and HAVING clause to get a
desired output through certain conditions.

Method: Using Transformations.

3.0 Course Outcomes Addressed


a) Create and Manage Database using SQL.
b) Design Normalized database on given data.
c) Create and manage Data base using SQL command.
d) Write a SQL command for given data base.
e) Apply security and confidentiality on given database.
4.0 Literature Review
To satisfy the needs of users outside of business applications, DBMSs must be expanded to
offer services in two other dimensions, namely object management and knowledge management.
Object management entails efficiently storing and manipulating non-traditional data types such as
bitmaps, icons, text, and polygons. Object management problems abound in CAD and many other
engineering applications. Knowledge management entails the ability to store and enforce a
collection of rules that are part of the semantics of an application. Such rules describe integrity
constraints about the application, as well as allowing the derivation of data that is not directly
stored in the database.

A) SELECT COMMAND -
B) WHERE CLAUSE -
C) HAVING CLAUSE –

DATABASE MANAGEMENT SYSTEM Page


Annexure II

A) SELECT COMMAND -

A SELECT/COMMAND statement retrieves zero or more rows from one or


more database tables or database views. In most applications, SELEC is the most
commonly used data query language (DQL) command. As SQL is a declarative
programming language, SELEC queries specify a result set, but do not specify how to
calculate it. The database translates the query into a "query plan" which may vary between
executions, database versions and database software. This functionality is called the "query
optimizer" as it is responsible for finding the best possible execution plan for the query,
within applicable constraints.

Syntax:

Select *
from
Example:
{table_name}
order by {unique_key}
SELECT * FROM
( SELECT
ROW_NUMBER() OVER (ORDER BY sort_key ASC) AS row_number, columns
FROM tablename
) AS foo
WHERE row_number <= 11;

DATABASE MANAGEMENT SYSTEM Page


Annexure II

B) WHERE CLAUSE -

A WHE clause in SQL specifies that a SQL Data Manipulation Language


(DML) statement should only affect rows that meet specified criteria. The criteria are expressed in the
form of predicates. WHE clauses are not mandatory clauses of SQL DML statements, but can be
used to limit the number of rows affected by a SQL DML statement or returned by a query. In brief
SQL WHERE clause is used to extract only those results from a SQL statement, such as: SELECT,
INSERT, UPDATE, or DELETE statement. The WHE clause is used in conjunction with SQL
DML statements

Syntax:

Select * or column1, column2, …………


from
{table_name}
where

Example:

SELECT * FROM
Customer
WHERE customer_id = 101;

DATABASE MANAGEMENT SYSTEM Page


Annexure II

C) HAVING CLAUSE -
A HAVIN clause in SQL specifies that an SQL SELE statement should only return rows where
aggregate values meet the specified conditions. It was added to the SQL language because
the
WHE keyword could not be used with aggregate functions.
The
HAVIN clause filters the data on the group row but not on the individual row.
To view the present condition formed by the clause, the clause is used.
GROUP HAVIN

Syntax:

SELECT
column_name(s)
Example:
FROM {table_name}
WHERE condition
GROUP BY
SELECT column_name(s)
DeptID,
HAVING conditionFROM Sales
SUM(SaleAmount)
5.0 Actual Procedure Followed
WHERE SaleNumber = 8872
GROUP BY DeptID
1. Designed plans through which we can get ideology of executing queries.
2. Created two tables using >DML
HAVING SUM(SaleAmount) commands.
1000
3. Inserted values into those two tables.
4. Displayed the tables with their records with SELECT command.
5. Executed queries by using WHERE and HAVING clause with the help of SELECT
command to tackle and get output according to the conditions.
6. Tested the queries 4-5 times before the final confirmation.
7. Attached the output of project at the end.
8. Finalized report.

DATABASE MANAGEMENT SYSTEM Page


Annexure II

6.0 Resources Required

Sr. Name of Specifications Qty. Remarks


No. Resource/material
1 Computer 4.00 GB RAM with 32
bit OS windows 7
1
-
2 Software Oracle 11g SQL 1
-
3 Printer HP Deskjet P2 6200
printer 1 -
7.0 Skill Developed / learning out of this Micro-Project
The project can be used in many aspects where there is a need of the database to store
the records of specific things be it a school, university or office. It can also be used in storing
data of any sport player, game’s statistics and many other things. Secondly the queries can be
used to learn DBMS more clearly and its various features.

8.0 Outputs of the Micro-Projects


QUERY:

 Creating two tables : EMPLOYEE and DEPARTMENT

a. create table EMPLOYEE


(emp_name varchar(15), emp_id number(3), salary number(7));
b. create table DEPARTMENT
(dept_name varchar(15),dept_id number(3), emp_id number(3), location varchar(15));

 Inserting values or records in two tables


a. Inserting for EMPLOYEE :

insert into EMPLOYEE values('Rohan', 101, 85000);


insert into EMPLOYEE values('Suyash', 102, 65000);
insert into EMPLOYEE values('Abhishek', 103, 50000);
insert into EMPLOYEE values('Om', 104, 37000);
insert into EMPLOYEE values('Ram', 105, 85000);

b. Inserting for DEPARTMENT :

insert into DEPARTMENT values('Management', 101,101, 'Thane');


insert into DEPARTMENT values('Marketing', 102,102, 'Badlapur');
insert into DEPARTMENT values('Distribution', 103,103, 'Ghatkopar');
insert into DEPARTMENT values('Distribution', 103, 104, 'Dadar');
insert into DEPARTMENT values('Marketing', 102,105, 'Kalyan');

DATABASE MANAGEMENT SYSTEM Page


Annexure II

 Displaying the table with its attributes and records


a. Displaying EMPLOYEE:
Select * from EMPLOYEE;

b. Displaying DEPARTMENT:
Select * from DEPARTMENT;
 Executing QUERIES using WHERE and HAVING CLAUSE

select dept_id, emp_name, salary, location

from DEPARTMENT d, EMPLOYEE e


where d.emp_id = e.emp_id
group by dept_id, emp_name, salary, location
having salary >= 50000
order by dept_id;

DATABASE MANAGEMENT SYSTEM Page


Annexure II

2. Abhishek Chaudhari -
42

Name of Team Members with Roll No.


1. Om Ghugare (30)
2. Abhishek Chaudhari (31)
3. Suyash Nangare (32)
4. Rohan Khachane (33)

DATABASE MANAGEMENT SYSTEM Page

You might also like