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.
- The “interval” represents the interval of time to be added.
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 ...
Trending nowThis is a popular solution!
Chapter 8 Solutions
A Guide to SQL
- TOPIC: SQL Select Statement for making Queries in MS Acess Problem: Select the average price of all of the items ordered that were purchased in the month of Dec. Given Table/Data:arrow_forwardI got a question on number 1 through 3 from MySQL. these are the steps: Write the SQL code that will list all of the drivers in the database that have been issued tickets. Write the SQL code that will list all of the drivers in the database that have not been issued tickets. Write the SQL code that will list all of the drivers in the database that have been issued tickets, along with the total number of tickets that they have been issued and the total amount of fines that they have been charged. Do you guys know how to do these steps?arrow_forwardCould you explain SQL in more detail?arrow_forward
- What is the difference between clustered and non-clustered indexes in SQL?arrow_forwardI need help answering this question for my Database Management class for SQL Developer. Thank you REP (REP_NUM, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, POSTAL_CODE, COMMISSION, RATE) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, STREET, CITY, STATE, POSTAL_CODE, BALANCE, CREDIT_LIMIT, REP_NUM) ORDERS (ORDER_NUM, ORDER_DATE, CUSTOMER_NUM) ORDER_LINE (ORDER_NUM, ITEM_NUM, NUM_ORDERED, QUOTED_PRICE) ITEM (ITEM_NUM, DESCRIPTION, ON_HAND, CATEGORY, STOREHOUSE, PRICE) For each postal code, how many customers are there and its total_balance. Report Postal_Code, Num_of_Customers, T_Balancearrow_forwardExplain why SQL is called a set-oriented languagearrow_forward
- I need help with this question for my Database Management class for SQL developer. Thank you REP (REP_NUM, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, POSTAL_CODE, COMISSION, RATE) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, STREET, CITY, STATE, POSTAL_CODE, BALANCE, CREDIT_LIMIT, REP_NUM) ORDERS (ORDER_NUM, ORDER_DATE, CUSTOMER_NUM) ORDER_LINE (ORDER_NUM, ITEM_NUM, NUM_ORDERED, QUOTED_PRICE) ITEM (ITEM_NUM, DESCRIPTION, ON_HAND, CATEGORY, STOREHOUSE, PRICE) Write SQL Queries to: a) Permit joshi to update the ITEM table. b) Increase the Price of Items in ITEM by 10% c) Create an index on balance for the Customer table. d) Add a new order to the database, where Order_Num is 51627 (character type) , Customer_Num is 111 (numeric), and Order_Date is 10/17/2015. e) Add a 5 character column Item_Location to ITEM table.arrow_forwardI need help with this question for my Database Management class for SQL developer. Thank you REP (REP_NUM, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, POSTAL_CODE, COMISSION, RATE) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, STREET, CITY, STATE, POSTAL_CODE, BALANCE, CREDIT_LIMIT, REP_NUM) ORDERS (ORDER_NUM, ORDER_DATE, CUSTOMER_NUM) ORDER_LINE (ORDER_NUM, ITEM_NUM, NUM_ORDERED, QUOTED_PRICE) ITEM (ITEM_NUM, DESCRIPTION, ON_HAND, CATEGORY, STOREHOUSE, PRICE) Question: List TOY category items and orders placed for them. Report: Item_Num, Description, Order_Num, and Order_Datearrow_forwardYou have the following tables: MANAGERS (MANAGER_ID, LAST_NAME, FIRST_NAME, DEPARTMENT) ACCOUNTS (ACCOUNT_NUMBER, MANAGER_ID, CUST_ID, BALANCE) CUSTOMERS (CUST_ID, LAST_NAME, FIRST_NAME) Write a SQL statement that lists account number, balance, MANAGER’s last name, CUSTOMER ID, and CUSTOMER’s last name for every account in the ACCOUNTS table.arrow_forward
- Please help with the following: Write following SQL Queries:A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION, List all the rows in which the prescription dates occur on or after November 14. How many doctors provide prescriptions with 30 tablets in total? List doctor’s details where speciality is either Dermatology or Neurology. (Use INoperator). List the results by the first name in ascending order and the last name indescending order Find all patients rows whose first names include ‘George’ (Assume case sensitivity). List number of patients that do not have a phone number. How many drugs with price < 40$? How many prescriptions are generated for each patient, limit the listing to patients who have more than 2 prescriptions? List the drug codes and prices (rounded to one decimal place). How many doctors prescribe the drug code KO15? List all drugs with their expiration date (one year from the date of manufacturer)…arrow_forwardsql queries Employees(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE,JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID,DEPARTMENT_NAME)Department(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID)Location(LOCATION_ID,STREET_ADDRESS,POSTAL_CODE,CITY,STATE_PROVINCE,COUNTRY_ID) Write a query in SQL to display the Entire data of All those employees whoseDEPARTMENT_ID is greater than the DEPARTMENT_ID of all those employees who earn morethan 50,000 per month Write a query in SQL to display the minimum, maximum salary and DEPARTMENT_NAMEof all those departments whose minimum salary is greater than 4000 in ascending order.arrow_forwardSQL QUERIES Employees(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE,JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID,DEPARTMENT_NAME)Department(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID)Location(LOCATION_ID,STREET_ADDRESS,POSTAL_CODE,CITY,STATE_PROVINCE,COUNTRY_ID) Write a Query in SQL to delete the record of all those cities where city name ends with b fromlocations table.arrow_forward
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning