Database Systems: Design, Implementation, & Management
12th Edition
ISBN: 9781305627482
Author: Carlos Coronel, Steven Morris
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 41P
Program Plan Intro
Aggregate Functions:
SQL has some built-in functions and they are called as aggregate functions. SQL contains five built-in functions. They are:
- SUM – This function is used to add values from the particular column.
- Syntax: SELECT SUM(column_Name) FROM table_Name;
- COUNT – This is used to count the number of rows for the particular column.
- Syntax: SELECT COUNT(column_Name) FROM table_Name;
- MAX – This function is used to get the maximum value from the column.
- Syntax: SELECT MAX(column_Name) FROM table_Name;
- MIN – This function is used to get the minimum value from the column.
- Syntax: SELECT MIN(column_Name) FROM table_Name;
- AVG – This function is used to get the average of all the values from the column.
- Syntax: SELECT AVG(column_Name) FROM table_Name;
DISTINCT Keyword:“DISTINCT” keyword is used to avoid redundant data (removing duplicate values) from a column. The syntax for “DISTINCT” keyword is as follows:
Syntax:
SELECT DISTINCT column_Name FROM table_Name;
“NOT IN” Keyword: “NOT IN” keyword retrieves all the elements of the first table and the contents that are not matched in the second table.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
List the balance characteristics of the customers who have made purchases during the current invoice cycle—that is, for the customers who appear in the INVOICE table. The results of this query are shown in Figure P7.37.
Show all name and phone numbers of students and the type of donation they received including any unmatched student.table name;StudentDonationVolunteer
7. List all customers who were referred to the bookstore by another customer. List eachcustomer’s last name and the number of the customer who made the referral.
Chapter 7 Solutions
Database Systems: Design, Implementation, & Management
Ch. 7 - Prob. 1RQCh. 7 - Explain why the following command would create an...Ch. 7 - Prob. 3RQCh. 7 - Explain why it might be more appropriate to...Ch. 7 - What is the difference between a column constraint...Ch. 7 - What are referential constraint actions?Ch. 7 - Rewrite the following WHERE clause without the use...Ch. 7 - Explain the difference between an ORDER BY clause...Ch. 7 - Explain why the following two commands produce...Ch. 7 - What is the difference between the COUNT aggregate...
Ch. 7 - Prob. 11RQCh. 7 - Prob. 12RQCh. 7 - Write the SQL code that will create the table...Ch. 7 - Having created the table structure in Problem 1,...Ch. 7 - Prob. 3PCh. 7 - Prob. 4PCh. 7 - Write the SQL code to change the job code to 501...Ch. 7 - Write the SQL code to delete the row for William...Ch. 7 - Write the SQL code that will restore the data to...Ch. 7 - Write the SQL code to create a copy of EMP_1,...Ch. 7 - Write the SQL code to change the EMP_PCT value to...Ch. 7 - Using a single command sequence, write the SQL...Ch. 7 - Prob. 11PCh. 7 - Write the SQL code that will change the PROJ_NUM...Ch. 7 - Write the two SQL command sequences required to:...Ch. 7 - Prob. 14PCh. 7 - Prob. 15PCh. 7 - Using the EMPLOYEE, JOB, and PROJECT tables in the...Ch. 7 - Write the SQL code that will produce the same...Ch. 7 - Write the SQL code to find the average bonus...Ch. 7 - Prob. 19PCh. 7 - Prob. 20PCh. 7 - Write the SQL code to calculate the ASSIGN_CHARGE...Ch. 7 - Using the data in the ASSIGNMENT table, write the...Ch. 7 - Prob. 23PCh. 7 - Write the SQL code to generate the total hours...Ch. 7 - Prob. 25PCh. 7 - Prob. 26PCh. 7 - Prob. 27PCh. 7 - Generate a listing of all purchases made by the...Ch. 7 - Using the output shown in Figure P7.29 as your...Ch. 7 - Prob. 30PCh. 7 - Prob. 31PCh. 7 - Use a query to compute the average purchase amount...Ch. 7 - Prob. 33PCh. 7 - Prob. 34PCh. 7 - Prob. 35PCh. 7 - Prob. 36PCh. 7 - Prob. 37PCh. 7 - Using the results of the query created in Problem...Ch. 7 - Create a query to find the balance characteristics...Ch. 7 - Prob. 40PCh. 7 - Prob. 41PCh. 7 - Prob. 42PCh. 7 - Prob. 43PCh. 7 - Prob. 44PCh. 7 - Write a query to display the SKU (stock keeping...Ch. 7 - Prob. 46PCh. 7 - Prob. 47PCh. 7 - Prob. 48PCh. 7 - Prob. 49PCh. 7 - Prob. 50PCh. 7 - Prob. 51PCh. 7 - Prob. 52PCh. 7 - Prob. 53PCh. 7 - Prob. 54PCh. 7 - Prob. 55PCh. 7 - Prob. 56PCh. 7 - Prob. 57PCh. 7 - Prob. 58PCh. 7 - Prob. 59PCh. 7 - Prob. 60PCh. 7 - Prob. 61PCh. 7 - Prob. 62PCh. 7 - Prob. 63PCh. 7 - Prob. 64PCh. 7 - Prob. 65PCh. 7 - Prob. 66PCh. 7 - Prob. 67PCh. 7 - Prob. 68PCh. 7 - Prob. 69PCh. 7 - Prob. 70PCh. 7 - Prob. 71PCh. 7 - Prob. 72PCh. 7 - Prob. 73PCh. 7 - Prob. 74PCh. 7 - Prob. 75PCh. 7 - Prob. 76PCh. 7 - Prob. 77PCh. 7 - Prob. 78PCh. 7 - Prob. 79PCh. 7 - Prob. 80PCh. 7 - Prob. 81PCh. 7 - Prob. 82PCh. 7 - Prob. 83PCh. 7 - Prob. 84PCh. 7 - Prob. 85PCh. 7 - Prob. 86PCh. 7 - Prob. 87PCh. 7 - Prob. 88PCh. 7 - Prob. 89PCh. 7 - Prob. 90PCh. 7 - Prob. 91PCh. 7 - Prob. 92PCh. 7 - Prob. 93PCh. 7 - Prob. 94PCh. 7 - Prob. 95PCh. 7 - Write the SQL code to create the table structures...Ch. 7 - The following tables provide a very small portion...Ch. 7 - Write the SQL command to save the rows inserted in...Ch. 7 - Write the SQL command to change the movie year for...Ch. 7 - Prob. 100CCh. 7 - Prob. 101CCh. 7 - Prob. 102CCh. 7 - Prob. 103CCh. 7 - Prob. 104CCh. 7 - Prob. 105CCh. 7 - Prob. 106CCh. 7 - Prob. 107CCh. 7 - Prob. 108CCh. 7 - Prob. 109CCh. 7 - Prob. 110CCh. 7 - Prob. 111CCh. 7 - Prob. 112CCh. 7 - Prob. 113CCh. 7 - Prob. 114CCh. 7 - Prob. 115CCh. 7 - Prob. 116CCh. 7 - Prob. 117CCh. 7 - Prob. 118CCh. 7 - Prob. 119CCh. 7 - Prob. 120CCh. 7 - Prob. 121CCh. 7 - Prob. 122CCh. 7 - Prob. 123CCh. 7 - Prob. 124CCh. 7 - Write a query to display the movie number, movie...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Q1- List all employees whose job_id is IT_PROG and hired after 01-JAN-95 and earning more than5000.Q2- List all employee except those with employee_id 101, 102, 103, 104 and 105Q3- Display the city attribute from locations table. Show the ones that contain “South” in the city.Sort the list in descending order.Q4- Display the first name, last name, salary, manager id and job id of all employees whose last fourcharacters of job id ends with “LERK”.Q5- Display the first name, last name and salary of all employees. Round the salary to the nearestunit of 1000 (ex. Salary=4500 New Salary=5000). Label the column as "New Salary".arrow_forward5. Determine the profit of each book sold to Jake Lucas, using the actual price the customerpaid (not the book’s regular retail price). Sort the results by order date. If more than onebook was ordered, sort the results by profit amount in descending order. Perform thesearch using the customer name, not the customer number.arrow_forwardList the names of all Staff members who hold a faculty position and have a salary of $45,000 or less. Show their names as their first name, followed by a space, and then their last name but sort the list alphabetically by last name and then first name. Hint: Check out the Position column in the Staff table. All staff members who do not hold a faculty position will get a bonus this year equal to 5% of their salary. List the names, current salary, and bonus amount for each Staff member (non-faculty) who is due a bonus. Show your list in order with the person receiving the highest bonus first.arrow_forward
- Using the SELECT statement, query the invoice table to find the average total cost for all orders purchased in the country USA, rounded to the nearest cent. O a.) 5.8 O b.) 5.7 O c.) 6 O d.) 5.80arrow_forwardselect first name of customer and the highest total in invoice in sqlarrow_forwardNote:- Do correct answer get upvote Else downvotedarrow_forward
- Using the information in the ASSIGNMENT table, write SQL code that will return the total number of hours worked by each employee and the total cost of those hours, sorted by employee number.arrow_forwardSome rows of the STUDENT table are shown below: CODE NAME GPA YEAR 291 ALEX 3.1 2 938 MICHELE 2.3 1 931 JHON 3.3 1 182 JOE 3.4 2 190 REY 2.0 2 330 RON 3.9 3 Which best describes the result of the query below? SELECT YEAR, AVG(GPA) FROM STUDENT WHERE GPA > 2.0 GROUP BY YEAR a. The average maximum GPA of all the students in each year. b. The year of the student with the maximum GPA. c. The average GPA of students with a GPA higher than 2.0 each year. d. The average GPA of the students with a GPA higher than 2.0.arrow_forward4. Which customers live in Georgia or New Jersey? Put the results in ascending order by lastname. List each customer’s customer number, last name, and state. Write this query in twodifferent waysarrow_forward
- please create a subquery using sqlarrow_forwardList the customer ID and first and last names for all customers located in the city of Cody. Your query should ignore case. For example, a customer with the city Cody should be included, as should customers whose city is CODY, cody, cOdY, and so onarrow_forwardUsing the data in the ASSIGNMENT table, write the SQL code that will yield the total number of hours worked for each employee and the total charges stemming from those hours worked, sorted by employee number. The results of running that query are shown in Figure P7.6.FIGURE P7.6 TOTAL HOURS AND CHARGES BY EMPLOYEEarrow_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 PtrNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L