Database Systems: Design, Implementation, & Management
11th Edition
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
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 7, Problem 9RQ
Explain why the following two commands produce different results: SELECT DISTINCT COUNT (V_CODE) FROM PRODUCT; SELECT COUNT (DISTINCT V_CODE) FROM PRODUCT;
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
What is the result of the query below: SELECT V_CODE, COUNT (P_CODE)
FROM PRODUCT
HAVING V_CODE != 21344;
A) A list of V_CODE, and the number of products for each V_CODE that is equal to 21344.
B) An error message.
C) A list of V_CODE, and the number of products for each V_CODE that is not equal to 21344.
D) The number of counts for each P_CODE that has a V_CODE that is not equal to 21344.
USE NORTHWIND DATABASE
Write a SELECT statement using the CASE function. The statement returns two columns basedon how many orders the customer has in the database. The first column is the customer name andthe second column, Membership Type, is based on which case applies to the customer:If the customer has more than 25 orders they are a Diamond Customer.If the customer has more than 15 orders they are a Gold Customer.If the customer has more than 10 orders they are a Silver Customer.If the customer has more than 5 orders they are an Iron Customer.Otherwise the customer is a Valued Customer.
USE this part to write SQL statements
Branch(branch_id:integer, branch_name:varchar(50), branch_location:varchar(40), money_on_hand:numeric(15,2)
create table Branch
(branch_id integer,
branch_name varchar(50),
branch_location varchar(40),
money_on_hand numeric(15,2),
primary key (branch_id));
Loan(loan_number:integer, branch_id:integer, amount:numeric(8,2))
foreign key branch_id references Branch(branch_id)
create table Loan
(loan_number integer,
branch_id integer,
amount numeric(8,2),
primary key (loan_number),
foreign key (branch_id) references Branch (branch_id));
Customer(customer_id:integer, customer_last_name:varchar(35),customer_first_name:varchar(25), customer_street:varchar(30), customer_zip:integer)
create table…
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 - Prob. 7PCh. 7 - Prob. 8PCh. 7 - Write the SQL code to change the EMP_PCT value to...Ch. 7 - Prob. 10PCh. 7 - Prob. 11PCh. 7 - Write the SQL code that will change the PROJ_NUM...Ch. 7 - Prob. 13PCh. 7 - Prob. 14PCh. 7 - Prob. 15PCh. 7 - Prob. 16PCh. 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 - Prob. 22PCh. 7 - Prob. 23PCh. 7 - Prob. 24PCh. 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 - Prob. 45PCh. 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 - Write the SQL code to create the table structures...Ch. 7 - The following tables provide a very small portion...Ch. 7 - Prob. 67CCh. 7 - Prob. 68CCh. 7 - Prob. 69CCh. 7 - Prob. 70CCh. 7 - Prob. 71CCh. 7 - Prob. 72CCh. 7 - Prob. 73CCh. 7 - Prob. 74CCh. 7 - Prob. 75CCh. 7 - Prob. 76CCh. 7 - Prob. 77CCh. 7 - Prob. 78CCh. 7 - Prob. 79CCh. 7 - Prob. 80CCh. 7 - Prob. 81CCh. 7 - Prob. 82CCh. 7 - Prob. 83CCh. 7 - Prob. 84CCh. 7 - Prob. 85CCh. 7 - Prob. 86CCh. 7 - Prob. 87CCh. 7 - Prob. 88CCh. 7 - Prob. 89CCh. 7 - Prob. 90CCh. 7 - Prob. 91CCh. 7 - Prob. 92CCh. 7 - Prob. 93CCh. 7 - Prob. 94CCh. 7 - Prob. 95CCh. 7 - Prob. 96CCh. 7 - Prob. 97CCh. 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
- Textbook: Digital Systems Chapter 8 Question/Problem 44 I'm not sure if I'm running the correct Query for this problem. The question is: "Create a trigger named trg_char_hours that automatically updates the AIRCRAFT table when a new CHARTER row is added. Use the CHARTER table’s CHAR_HOURS_FLOWN to update the AIRCRAFT table’s AC_TTAF, AC_TTEL, and AC_TTER values. (Hint: use temp values, as the INSERT event does not accept the OLD keyword.)" I ran this query without any errors: CREATE TRIGGER trg_char_hours AFTER INSERT ON CHARTER FOR EACH ROW UPDATE AIRCRAFT SET AC_TTAF = AC_TTAF + NEW.CHAR_HOURS_FLOWN, AC_TTEL = AC_TTEL + NEW.CHAR_HOURS_FLOWN, AC_TTER = AC_TTER + NEW.CHAR_HOURS_FLOWN WHERE AIRCRAFT.AC_NUMBER = NEW.AC_NUMBER; But the answer is still incorrect because the last row doesn't have the expected values. I'm not sure why the test query would delete any row with a CHAR_TRIP ABOVE 10018. I attached a screen of the output I'm getting: I saw in another answer this:…arrow_forwardTextbook: Digital Systems Chapter 8 Question/Problem 44 I'm not sure if I'm running the correct Query for this problem. The question is: "Create a trigger named trg_char_hours that automatically updates the AIRCRAFT table when a new CHARTER row is added. Use the CHARTER table’s CHAR_HOURS_FLOWN to update the AIRCRAFT table’s AC_TTAF, AC_TTEL, and AC_TTER values. (Hint: use temp values, as the INSERT event does not accept the OLD keyword.)" I ran this query without any errors: CREATE TRIGGER trg_char_hours AFTER INSERT ON CHARTER FOR EACH ROW UPDATE AIRCRAFT SET AC_TTAF = AC_TTAF + NEW.CHAR_HOURS_FLOWN, AC_TTEL = AC_TTEL + NEW.CHAR_HOURS_FLOWN, AC_TTER = AC_TTER + NEW.CHAR_HOURS_FLOWN WHERE AIRCRAFT.AC_NUMBER = NEW.AC_NUMBER; But the answer is still incorrect because the last row doesn't have the expected values. I'm not sure why the test query would delete any row with a CHAR_TRIP ABOVE 10018. I attached a screen of the output I'm getting:arrow_forwardProblems 1114 are based on the following query: SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM(LINE_UNITS) (SELECT MAX(LINE_UNITS) FROM LINE); Write the command to create statistics for this table.arrow_forward
- Rename the EMPLOYEES table as JL_EMPS.arrow_forwardProblems 2224 are based on the following query: SELECT P_CODE, P_DESCRIPT, P_PRICE, P.V_CODE, V_STATE FROM PRODUCT P, VENDOR V WHERE P.V_CODE = V.V_CODE AND V_STATE = 'NY' AND V_AREACODE = '212' ORDER BY P_PRICE; Write the command(s) used to generate the statistics for the PRODUCT and VENDOR tables.arrow_forwardProduce a list of information about all existing constraints on the STORE_REPS table.arrow_forward
- Use SQL Developer or Oracle Live SQL to write the appropriate SQL commands as follows: A) FUNCTION: Use the region table to create a function called ‘Return_region_name’ which accepts an input parameter ‘region_id’, and print the name of the region with that id. Then execute this function with region_id = 1. [LAB-7] (3) B) PROCEDURE: Use the cust_node table to create a procedure called ‘Get_node_id’ that takes the cust_id as an input parameter to show its corresponding node id to the banker. Then execute this procedure with cust_id=5. [LAB-7] (2) C) Trigger: Create a row-level trigger called ‘Compute_Amount_trigger’ on the cust_txn table to automatically update the amount of withdraw transaction made after inserting or updating amount on the cust_txn table. Additionally, this trigger must show this statement ‘TRIGGER MESSAGE: The amount of cust_id and txn_type is modified successfully'. Then test your trigger by updating the cust_txn table. For example, update the amount of the…arrow_forwardCreate a function name BALANCE that returns the status of outstanding amount for each customer. Use the following criteria for your function: Outstanding_amt less than 5000 , returns ‘SMALL AMOUNT’ Outstanding_amt between 5000 and 10000 , returns ‘AVERAGE AMOUNT’ Outstanding_amt greater than 10000 , returns ‘LARGE AMOUNT’ Use function BALANCE in your SQL statements that display the cust_code, cust_name, Outstanding_amt and function BALANCE.arrow_forwardWrite SQL statements to list the name of Lee’s subordinate employee. (Data Update) Write SQL statements to increase by 100000 the budget of the project whose name is starting with ‘B’. Write SQL statements to delete the rows for the LR (Little Rock) employees who are under the supervision of supervisor 8.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageDatabase 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
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
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
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
SQL Basics for Beginners | Learn SQL | SQL Tutorial for Beginners | Edureka; Author: edureka;https://www.youtube.com/watch?v=zbMHLJ0dY4w;License: Standard YouTube License, CC-BY