A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 8, Problem 2RQ
Explanation of Solution
Round a number to a specific number of decimal places in Oracle, Access and SQL Server:
- In Oracle, Access and SQL server, user can round a number to a specific number of decimal places by using “ROUND” function.
“ROUND” function:
- This function is used to rounds a number to a specified number of decimal places.
- This function contains more than one argument.
- Syntax for “ROUND” function:
ROUND(number, DecimalPlaces)
- From the given syntax, the argument “number” defines the value to be rounded and the argument “DecimalPlaces” represents the number of decimal places to which to round the result.
- Consider an example, “ROUND(46.78, 0)” will give the result as “47”...
Explanation of Solution
Remove each value to the right of the decimal places using Oracle, Access and Server:
For Oracle and SQL Server:
For Oracle and SQL server, user can use the “FLOOR” function to remove each number to the right of decimal point.
“FLOOR” function:
- This function is used to truncate everything to the right of decimal value.
- Syntax for “FLOOR” function:
FLOOR(value)
From the given syntax, the “value” represents numeric value.
Example of “FLOOR” function:
The example for “FLOOR” function in query concept is given below:
SELECT FLOOR(86.32) AS COMPUTED_VALUE;
- The above query is used to eliminate everything to the right of decimal value using “FLOOR” function.
- The computed value is represented by “COMPUTED_VALUE” using “AS” operator.
When the query is executed, the following output will be displayed...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
In SQL, how do you get the union of two tables?
In SQL, how do you find the intersection of two tables?
In SQL, how do you compute the difference between two tables?
Are the tables restricted in any way while executing any of these operations?
Difference between the aggregate functions
and windows functions in SQL Server.
Please answer as many questions as you can!
Chapter 8 Solutions
A Guide to SQL
Ch. 8 - Prob. 1RQCh. 8 - Prob. 2RQCh. 8 - Prob. 3RQCh. 8 - Prob. 4RQCh. 8 - Prob. 5RQCh. 8 - Prob. 6RQCh. 8 - Prob. 7RQCh. 8 - Prob. 8RQCh. 8 - Prob. 9RQCh. 8 - In PL/SQL, how do you assign variables the same...
Ch. 8 - Prob. 11RQCh. 8 - Prob. 12RQCh. 8 - Prob. 13RQCh. 8 - Prob. 14RQCh. 8 - Prob. 15RQCh. 8 - Prob. 16RQCh. 8 - Prob. 17RQCh. 8 - Prob. 18RQCh. 8 - Prob. 19RQCh. 8 - Prob. 20RQCh. 8 - Prob. 21RQCh. 8 - Prob. 22RQCh. 8 - Prob. 1TDCh. 8 - Prob. 2TDCh. 8 - Prob. 3TDCh. 8 - Prob. 4TDCh. 8 - Prob. 5TDCh. 8 - Prob. 6TDCh. 8 - Prob. 7TDCh. 8 - Prob. 8TDCh. 8 - Prob. 9TDCh. 8 - Prob. 10TDCh. 8 - Prob. 1CATCh. 8 - Prob. 2CATCh. 8 - Prob. 3CATCh. 8 - Prob. 4CATCh. 8 - Prob. 5CATCh. 8 - Prob. 6CATCh. 8 - Prob. 7CATCh. 8 - Prob. 9CATCh. 8 - Prob. 1SCGCh. 8 - Prob. 2SCGCh. 8 - Prob. 3SCGCh. 8 - Prob. 4SCGCh. 8 - Prob. 5SCGCh. 8 - Prob. 6SCGCh. 8 - Prob. 7SCGCh. 8 - SQL includes many numerical functions. Two of...
Knowledge Booster
Similar questions
- Please help with the following: Using oracle sql live or sql developer what sql statements could be use to find the following: A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION, is now loaded with this assignment and you are ready to start. Please explore the database and then write the appropriate SQL command. 1.List the drug codes and prices (rounded to one decimal place). 2.How many doctors prescribe the drug code KO15? Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End;//* */ ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';CREATE TABLE DOCTOR (DOC_ID varchar2(5) PRIMARY KEY,DOC_LNAME varchar2(15),DOC_FNAME varchar2(15),DOC_INITIAL varchar2(1),DOC_SPECIALTY varchar2(15));INSERT INTO DOCTOR VALUES('29827','Sanchez','Julio','J','Dermatology');INSERT INTO DOCTOR VALUES('32445','Jorgensen','Annelise','G','Neurology');INSERT INTO DOCTOR…arrow_forwardSELECT, FROM, and WHERE statements. What happens if we do not report the attributes exactly as they are in MS SQL Server? How do we resolve the issues?arrow_forwardHow do you display letters in uppercase in MySQL, Oracle, and SQL Server? How do you display letters in lowercase in MySQL, Oracle, and SQL Server?arrow_forward
- What is the difference between SUBSTR and CHARINDEX in the SQL Server?arrow_forward(a) How do you take union of two tables in SQL? (b) How do you take the intersection of two tables in SQL? (c) How do you take the difference of two tables in SQL? (d) Are there any restrictions on the tables when performing any of these operations?arrow_forwardPlease help with the following: Using oracle sql live or sql developer what sql statements could be use to find the following: A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION, is now loaded with this assignment and you are ready to start. Please explore the database and then write the appropriate SQL command. 1. List all the rows in which the prescription dates occur on or after November 14. 2. How many doctors provide prescriptions with 30 tablets in total? Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End;//* */ ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';CREATE TABLE DOCTOR (DOC_ID varchar2(5) PRIMARY KEY,DOC_LNAME varchar2(15),DOC_FNAME varchar2(15),DOC_INITIAL varchar2(1),DOC_SPECIALTY varchar2(15));INSERT INTO DOCTOR VALUES('29827','Sanchez','Julio','J','Dermatology');INSERT INTO DOCTOR…arrow_forward
- i. What Is A Savepoint Command? ii. What Are Pseudo-columns? iii. How Can You Use Pseudo Columns In Procedural Statements? iv. How Can You Check If An Update Statement In Pl/sql Is Successfully Executed?arrow_forwardHow do I do this question in SQL command? Use the Oracle database employees table and CASE expression to decode the departmentid. Display the department id, last name, salary, and a column called “New Salary” whose value is based on the following conditions: If the department id is 10 then 1.25 * salary If the department id is 90 then 1.5 * salaryIf the department id is 130 then 1.75 * salary Otherwise, display the old salary.arrow_forwardPlease help with the following: Using oracle sql live or sql developer what sql statements could be use to find the following: A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION. Please explore the database and then write the appropriate SQL command. How many prescriptions are generated for each patient, limit the listing to patients whohave more than 2 prescriptions? List the drug codes and prices (rounded to one decimal place). sql doc below Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End;//* */ ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';CREATE TABLE DOCTOR (DOC_ID varchar2(5) PRIMARY KEY,DOC_LNAME varchar2(15),DOC_FNAME varchar2(15),DOC_INITIAL varchar2(1),DOC_SPECIALTY varchar2(15));INSERT INTO DOCTOR VALUES('29827','Sanchez','Julio','J','Dermatology');INSERT INTO DOCTOR VALUES('32445','Jorgensen','Annelise','G','Neurology');INSERT…arrow_forward
- What are all the different methods under sqlcommand?arrow_forwardThe goal of this lab exercise is to get familiar with the different SQL server editions and know where to find and download Express edition. Visit (www.microsoft.com/sqlserver) and familiarize yourself with website content and resources, then, answer the following questions: 1- Research the different available editions and write a summary of major differences (2 to 3 paragraphs). 2- Are there any free editions? 3- For how long would you be able to get a trial copy for Enterprise edition. 4- Submit screen shot(s) of SQL server download page in Word document format.arrow_forwardIntegrate Python Database Connectors with SQLite3 For this assignment, I will like you to do the following. Create a database called employees. The table should contain first name, last name, age, date of hire, and salary of the employees. You should run various SQL statement using SQLite3. I am looking for the following. 1) Create table 2) Insert employee 3) Update employee 4) Delete employee 5) Delete table.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase 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
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
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