0% found this document useful (0 votes)
50 views3 pages

Retrieval by Character Matching in and Not IN Clause Between Clause

1. The document discusses using SQL commands to perform arithmetic operations and logical operations on data in database tables. It provides examples of using operators like SELECT, WHERE, BETWEEN, IN, and arithmetic expressions. 2. It then lists 21 practice exercises for students to write and execute SQL queries to retrieve and filter table data based on various conditions. The exercises involve patterns like incrementing salaries, filtering on job or department, and combining multiple conditions. 3. Students are instructed to write the SQL queries, execute them, and provide snapshots of the output and their observations. Questions are also provided about pattern matching, extract functions, the use of WHERE with aggregates,

Uploaded by

Shahrukh Pinjari
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)
50 views3 pages

Retrieval by Character Matching in and Not IN Clause Between Clause

1. The document discusses using SQL commands to perform arithmetic operations and logical operations on data in database tables. It provides examples of using operators like SELECT, WHERE, BETWEEN, IN, and arithmetic expressions. 2. It then lists 21 practice exercises for students to write and execute SQL queries to retrieve and filter table data based on various conditions. The exercises involve patterns like incrementing salaries, filtering on job or department, and combining multiple conditions. 3. Students are instructed to write the SQL queries, execute them, and provide snapshots of the output and their observations. Questions are also provided about pattern matching, extract functions, the use of WHERE with aggregates,

Uploaded by

Shahrukh Pinjari
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/ 3

Part A

Aim: SQL commands:


i) To perform computations on table data
ii) Retrieval by character matching
iii) In and Not IN Clause
iv) Between Clause

Prerequisite: SQL.

Outcome: Understanding of arithmetic operation on data and logical operation on conditions.

Theory:

Arithmetic operations

Select <ColumnName1> <ColumnName2><ColumnName3><arithmetic expression>

Renaming column name while using arithmetic operations

Select <ColumnName1> <ColumnName2>arithmetic expression> “<ColumnName>”

Use of logical operators in where condition

Select <ColumnName1> <ColumnName2> where <cond1> and <cond2>


Select <ColumnName1> <ColumnName2> where <cond1> or <cond2>
Select <ColumnName1> <ColumnName2> where not<cond1>

Range searching

Select <ColumnName1> <ColumnName2> where < ColumnName> between <val1> and <val2>

Pattern Matching

Select <ColumnName1> <ColumnName2> where < ColumnName> like <pattern>

In and not in predicates

Select <ColumnName1> <ColumnName2> where < ColumnName> in (list)

Procedure:
1. Formulate the query for given problem.
2. Write the SQL query with proper input.
3. Execute the query.

Practice Exercise:

S.No Query Exercise


.
1 Find the incremented salary of all employee with 10% increment.
2 Find the (salary + Commission) as Total salary of all employees.
3 Find the gross salary of employee by following formula:
Gross_Salary= Basic Salary+DA+HRA+TA+MA
DA=110% of Basic Salary
HRA=30% of Basic Salary
TA= 1500
MA= 1000
4 List the Enames those are having five characters in their Names.
5 List the Enames those are starting with ‘S’ and with five characters.
6 List the emps those are having four chars and third character must be ‘r’.
7 List the Five character names starting with ‘S’ and ending with ‘H’.
8 List the emps whose Sal is four digit number ending with Zero.
9 List the emps whose names having a character set ‘ll’ together.
10 List the details of the emps whose Salaries more than the employee BLAKE.
11 List the emps whose Jobs are same as ALLEN.
12 List the Emps who are senior to their own MGRS.
13 List the emps Whose Jobs are same as MILLER or Sal is more than ALLEN.
14 Any jobs of deptno 10 those that are not found in deptno 20.
15 List the employees whose salary is more than 3000 after giving 20% increment.
16 List the emps who are not working in sales dept.
17 List the emps whose sal is greater than his managers salary.
18 List the emps Who Annual sal ranging from 22000 and 45000.
19 Display the Empno, Ename, Sal, Dname, Loc, Deptno, Job of all emps working at CJICAGO or
working for ACCOUNTING dept with Ann Sal>28000, but the Sal should not be=3000 or 2800 who
doesn’t belongs to the Mgr and whose no is having a digit ‘7’ or ‘8’ in 3rd position in the asc order
of Deptno and desc order of job.
20 Display the total information of the emps along with Grades in the asc order.
21 List the Empno, Ename, Sal, Dname, Grade, Exp, and Ann Sal of emps working for Dept10 or20.

Instructions:
1. Write and execute the query in Oracle SQL server.
2. Paste the snapshot of the output in input & output section.

Part B
Code:
Perform the operation and paste the running code here.

Input & Output:


Paste input and output image here.

Observation & Learning:


Write your observation and learning after performing the task.

Conclusion:
Write statement of conclusion here.
Questions:

1. Explain the use of % and _ in pattern matching with suitable examples.


2. Explain the use of extract function with suitable examples.
3. Dose WHERE clause work with aggregate functions?
4. What is the alternative of in operator?

You might also like