A GUIDE TO SQL
A GUIDE TO SQL
9th Edition
ISBN: 9781305897397
Author: Pratt
Publisher: CENGAGE L
Expert Solution & Answer
Book Icon
Chapter 8, Problem 3RQ

Explanation of Solution

Adding months to a date in Oracle:

  • User can add the months to a date using “ADD_MONTHS” function in Oracle.
  • Syntax of “ADD_MONTHS” function is,

  ADD_MONTHS(Date, integer_value)

  • From the given syntax, the “Date” represents a date time value and the “integer_value” represents the integer number.

Example:

The example of the “ADD_MONTHS” function in query concept is given below:

SELECT STUDENT_ID, ADD_MONTHS(EXAM_DATE, 2) AS MODIFIED_DATE;

The above query is used to display student ID and two months added exam date for each student from “STUDENT” table.

  • From the given query, the “ADD_MONTHS” function is used to add two months for each exam date in the given “STUDENT” table and the added month is represented by “MODIFIED_DATE” using “AS” operator.

Adding months to a date in Access:

  • User can add the months to a date using “DATEADD” function in SQL Server.
  • Syntax of “DATEADD” function is,

  DATEADD("interval", integer_value, date)

  • The given syntax contains three arguments.
    • The “interval” represents the interval of time to be added.
      • If the user wants add a month to date, then interval will be specified by “m”, “mm” or “month”.
      • For year, the interval will be specified by “year”, “yyyy” or “yy”.
      • For day, the interval will be specified by “day”, “dy” or “y”.
    • The “integer_value” represents the integer number.
    • The “Date” represents a date time value.

Example:

The example of the “DATEADD” function in query concept is given below:

SELECT STUDENT_ID, DATEADD("m", 2, EXAM_DATE) AS MODIFIED_DATE;

The above query is used to display student ID and two months added exam date for each student from “STUDENT” table...

Explanation of Solution

Adding days to a date:

  • User can add a number of days to a date without using any function.
  • User can add the number of days to a given date by simply placing addition operator with given integer value.

Example:

The example for adding a number of days to a date...

Explanation of Solution

Compute the number of days between two dates:

User can compute the number of days between two ...

Blurred answer
Students have asked these similar questions
Explian thiS C program #include<stdio.h> int countSetBits(int n) {    int count = 0;    while (n) {        count += n & 1;        n >>= 1;    }    return count;} int main() {    int num;    printf("Enter a number: ");    scanf("%d", &num);    printf("Output: %d units\n", countSetBits(num));    return 0;}
Please provide the Mathematica code
Explian this C program code. #include <stdio.h> void binary(unsigned int n) { if (n /2!=0) { binary(n /2); } printf("%d", n %2); } int main() { unsignedint number =33777; unsignedchar character ='X';   printf("Number: %u\n", number); printf("Binary: "); binary(number); printf("\nDecimal: %u\nHexadecimal: 0x%X\n\n", number, number);   printf("Character: %c\n", character); printf("ASCII Binary: "); binary(character); printf("\nASCII Decimal: %u\nASCII Hexadecimal: 0x%X\n", character, character);   return0; }
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning