0% found this document useful (0 votes)
3 views8 pages

Edited PR-4

The document outlines a practical exercise for database management focusing on SQL queries for date and numeric functions. It aims to develop students' skills in manipulating and analyzing date-related and numeric data, with expected outcomes including proficiency in SQL commands and adherence to coding standards. Additionally, it provides a list of required resources, safety precautions, and assessment criteria for evaluating student performance.

Uploaded by

lathiyaparth61
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)
3 views8 pages

Edited PR-4

The document outlines a practical exercise for database management focusing on SQL queries for date and numeric functions. It aims to develop students' skills in manipulating and analyzing date-related and numeric data, with expected outcomes including proficiency in SQL commands and adherence to coding standards. Additionally, it provides a list of required resources, safety precautions, and assessment criteria for evaluating student performance.

Uploaded by

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

Database Management (4331603)

Date: _________________
Practical No.4: In-built Functions (Part – 1)
a. Write SQL queries to use various date functions.
b. Write SQL queries to use various numeric functions

A. Objective:

To proficiently use SQL queries with various date functions and numeric
functions to effectively manipulate and analyse date-related and numeric data in the
database.

B. Expected Program Outcomes (POs)


Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the
engineering problems.
Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
Design/ development of solutions: Design solutions for engineering well-defined
technical problems and assist with the design of systems components or processes to
meet specified needs.
Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
Project Management: Use engineering management principles individually, as a team
member or a leader to manage projects and effectively communicate about well- defined
engineering activities.
Life-long learning: Ability to analyze individual needs and engage in updating in the
context of technological changes in field of engineering.

C. Expected Skills to be developed based on competency:


“Write SQL queries to use various date functions.”
This practical is expected to develop the following skills.
1. Ability to perform date-based calculations, comparisons, and aggregations to
analyze and report on time-related data accurately.

“Write SQL queries to use various numeric functions”


This practical is expected to develop the following skills.

41 | P a g e 236120316032
Database Management (4331603)

1) Skill in using advanced numeric functions such as POWER, SQRT, LOG, and
TRUNC to perform complex calculations and generate insights from numerical
data.

D. Expected Course Outcomes(Cos)


CO4: Apply SQL Commands for creating, manipulating and controlling databases.

E. Practical Outcome(PRo)
Students will be able to understand and use various date and numeric function.

F. Expected Affective domain Outcome(ADos)


1) Follow safety practices.
2) Follow Coding standards and practices.
3) Demonstrate working as a leader/ a team member.
4) Follow ethical practices.
5) Maintain tools and equipment.

G. Prerequisite Theory:
Numeric Function :-
1. ABS() : Returns the absolute value of numeric expression.
2. ACOS(): Returns the arccosine of numeric expression. Returns NULL if the value is
not in the range -1 to 1.
3. ASIN() : Returns the arcsine of numeric expression. Returns NULL if value is not in
the range -1 to 1
4. ATAN() : Returns the arctangent of numeric expression.
5. ATN2() : Returns the arctangent of the two variables passed to it.
6. CEILING() : Returns the smallest (closest to negative infinity) integer value that is
greater than or equal to this value.
7. COS() : Returns the trigonometric cosine of the given value.
8. COT() : Returns the trigonometric cotangent of the given value.
9. DEGREES() : Returns numeric expression converted from radians to degrees.
10. EXP() : Returns the base of the natural logarithm (e) raised to the power of passed
numeric expression.
11. FLOOR() : Returns the largest integer value that is not greater than passed numeric
expression.

42 | P a g e 236120316032
Database Management (4331603)

12. LOG() : Returns the natural logarithm of the passed numeric expression.
13. LOG10() : Returns the base-10 logarithm of the passed numeric expression.
14. PI() : Returns the value of pi
15. POWER() : Returns the value of one expression raised to the power of another
expression
16. RADIANS() : Returns the value of passed expression converted from degrees to
radians.
17. RAND() : Returns the random value between 0 and 1.
18. ROUND() : Returns numeric expression rounded to an integer. Can be used to
round an expression to a number of decimal points
19. SIGN() : Returns the sign of a number, indicating whether it is positive, negative, or
zero.
20. SIN() : Returns the sine of numeric expression given in radians.
21. SQRT() : Returns the non-negative square root of numeric expression.
22. TAN() : Returns the tangent of numeric expression expressed in radians.

Date Function :
1. ADDDATE(): It returns a date after a certain time/date interval has been added.
2. ADDTIME(): It returns a time / date time after a certain time interval has been
added.
3. CURDATE(): It returns the current date.
4. CURRENT_DATE(): It returns the current date.
5. CURRENT_TIME(): It returns the current time.
6. CURRENT_TIMESTAMP(): It returns the current date and time.
7. CURTIME(): It returns the current time.
8. DATE(): It extracts the date value from a date or date time expression.
9. DATEDIFF(): It returns the difference in days between two date values.
10. DATE_ADD(): It returns a date after a certain time/date interval has been added.
11. DATE_FORMAT(): It formats a date as specified by a format mask.

43 | P a g e 236120316032
Database Management (4331603)

12. DATE_SUB(): It returns a date after a certain time/date interval has been
subtracted.
13. DAY(): It returns the day portion of a date value.
14. DAYNAME(): It returns the weekday name for a date.
15. DAYOFMONTH(): It returns the day portion of a date value.
16. DAYWEEK(): It returns the weekday index for a date value.
17. DAYOFYEAR(): It returns the day of the year for a date value.
18. EXTRACT(): It extracts parts from a date.
19. FROM_DAYS(): It returns a date value from a numeric representation of the day.
20. HOUR(): It returns the hour portion of a date value.
21. LAST_DAY(): It returns the last day of the month for a given date.
22. LOCALTIME(): It returns the current date and time.
23. LOCALTIMESTAMP(): It returns the current date and time.
24. MAKEDATE(): It returns the date for a certain year and day-of-year value.
25. MAKETIME(): It returns the time for a certain hour, minute, second combination.

H. Resources/Equipment Required
Sr. Instrument/Equipment/
Specification Quantity
No. Components/Trainer kit
Computer (i3-i5 preferable), RAM
1 Hardware: Computer System
minimum 2 GB and onwards
As Per
2 Operating System Windows/ Linux/ MAC
Batch
3 Software Oracle Size

Notepad, Notepad++, Sublime Text or


4 Text Editor
similar

I. Safety and necessary Precautions followed


NA

J. Source code:

44 | P a g e 236120316032
Database Management (4331603)

A) Write SQL queries to use various date functions.


(a)Add 3 months in current date.

(b) Display months between date: ’17-02-04’ and


’17-02-05’.

(c) Display last date of month ‘2-feb-06’.

(d) If the date is 31-jul-13 then find out the date of friendship day.

B) Write SQL queries to use various numeric functions


(a) Display integer value of 125.25.

(b) Display absolute value of(-15)

45 | P a g e 236120316032
Database Management (4331603)

(c) Display ceil value of 55.65

(d) Display floor value of 100.2

(e) Display the square root of 16.

(f) Display square root of 20.

(g) Display result of 12 raised to 6.

(h) Display result of 24 mod 2.

(i) Show value of e3.

46 | P a g e 236120316032
Database Management (4331603)

(j) 2 is angle in radius find out cos, sin, tan value of 2.

(k) Show output of sign(-25), sign(25), sign(0).

K. Practical related Quiz.


1) Which SQL function can be used to add or subtract a specified interval of time from
a given date?
a) DATEDIFF ✓ b) DATEADD
c) DATEPART d) DATETIME

2) Which SQL function can be used to add or subtract a specified interval of time
from a given date?
a) DATEDIFF ✓ b) DATEADD
c) DATEPART d) DATETIME

3) Which Oracle numeric function can be used to calculate the absolute value of a
number?
A) ROUND B) CEIL
✓ B) ABS D) MOD

L. References / Suggestions
1) https://www.w3schools.com/sql/default.asp
2) https://www.tutorialspoint.com/dbms/
3) https://www.geeksforgeeks.org/dbms/

47 | P a g e 236120316032
Database Management (4331603)

M. Assessment-Rubrics

Faculty
Marks Obtained Date
Signature
Program Implementation Student’s engagement
Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

48 | P a g e 236120316032

You might also like