Pearson eText for Computer Science: An Overview -- Instant Access (Pearson+)
13th Edition
ISBN: 9780137503216
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON+
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 9, Problem 36CRP
Explanation of Solution
SQL code for previous problem:
The SQL code for the given program segment is as follows:
SELECT Employee.Name
FROM Employee, Job
WHERE Employee.EmpId = JoB.EmpId AND Job.Dept = 'SALES'
Explanation:
- The above SQL query is used to lists the “Name” from relations “EMPLOYEE” and “JOB” where the value of “EmpId” is equal in both relations and the value of “Dept” is “SALES”...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider an employee database with two relationsemployee (employee name, street, city)works (employee name, company name, salary) where the primary keys are underlined.Write a function avg salary that takes a company name as an argument and finds the average salary of employees at that company. Then, write an SQL statement, using that function, to find companies whose employees earn a higher salary, on average, than the average salary at “First Bank”.
Consider a database with the following tables:
v Patient(PatientID. PatientName, NumberOfVisits)
v Doctor(DoctorID, DoctorName)
v Appointment(ApplD, DoctorID, PatientID. Date, time)
Write SQL statements or the necessary steps that do the following:
a) Write the SQL statements required to create the above tables. You have to choose the best data
type for each column, and all necessary keys (primary and foreign
(FROM DATABASE SYSTEMS, 13TH ED.) Problem 15. Use a query to compute the total of all purchases, the number of purchases, and the average purchase amount made by each customer. Your output values must match those shown in Figure P7.15. Sort the results by customer code.
Chapter 9 Solutions
Pearson eText for Computer Science: An Overview -- Instant Access (Pearson+)
Ch. 9.1 - Identify two departments in a manufacturing plant...Ch. 9.1 - Prob. 2QECh. 9.1 - Summarize the roles of the application software...Ch. 9.2 - Prob. 1QECh. 9.2 - Prob. 2QECh. 9.2 - Prob. 4QECh. 9.2 - Prob. 5QECh. 9.2 - Prob. 6QECh. 9.3 - Prob. 1QECh. 9.3 - What is a persistent object?
Ch. 9.3 - Identify some classes as well as some of their...Ch. 9.3 - Prob. 4QECh. 9.4 - Prob. 1QECh. 9.4 - Prob. 2QECh. 9.4 - Prob. 3QECh. 9.4 - Prob. 4QECh. 9.4 - Prob. 5QECh. 9.4 - Prob. 6QECh. 9.5 - Prob. 1QECh. 9.5 - Prob. 2QECh. 9.5 - Prob. 3QECh. 9.5 - Prob. 4QECh. 9.5 - Prob. 5QECh. 9.5 - Prob. 6QECh. 9.5 - Prob. 7QECh. 9.6 - Prob. 1QECh. 9.6 - Give an additional example of a pattern that might...Ch. 9.6 - Prob. 3QECh. 9.6 - How does data mining differ from traditional...Ch. 9.7 - Prob. 1QECh. 9.7 - Prob. 2QECh. 9.7 - Prob. 3QECh. 9.7 - Prob. 4QECh. 9 - Prob. 1CRPCh. 9 - Prob. 2CRPCh. 9 - Prob. 3CRPCh. 9 - Prob. 4CRPCh. 9 - Prob. 5CRPCh. 9 - Prob. 6CRPCh. 9 - Prob. 7CRPCh. 9 - Prob. 8CRPCh. 9 - Prob. 9CRPCh. 9 - Prob. 10CRPCh. 9 - Prob. 11CRPCh. 9 - Prob. 12CRPCh. 9 - Using the commands SELECT, PROJECT, and JOIN,...Ch. 9 - Answer Problem 13 using SQL. PROBLEM 13 13. Using...Ch. 9 - Prob. 15CRPCh. 9 - Prob. 16CRPCh. 9 - Prob. 17CRPCh. 9 - Prob. 18CRPCh. 9 - Prob. 19CRPCh. 9 - Empl Id Name Address SSN Job Id Job Title Skill...Ch. 9 - Empl Id Name Address SSN Job Id Job Title Skill...Ch. 9 - Prob. 22CRPCh. 9 - Prob. 23CRPCh. 9 - Prob. 24CRPCh. 9 - Prob. 25CRPCh. 9 - Write a sequence of instructions (using the...Ch. 9 - Prob. 27CRPCh. 9 - Prob. 28CRPCh. 9 - Prob. 29CRPCh. 9 - Prob. 30CRPCh. 9 - Prob. 31CRPCh. 9 - Prob. 32CRPCh. 9 - Prob. 33CRPCh. 9 - Prob. 34CRPCh. 9 - Prob. 35CRPCh. 9 - Prob. 36CRPCh. 9 - Prob. 37CRPCh. 9 - Prob. 38CRPCh. 9 - Prob. 39CRPCh. 9 - Prob. 40CRPCh. 9 - Prob. 41CRPCh. 9 - Prob. 42CRPCh. 9 - Prob. 43CRPCh. 9 - Prob. 44CRPCh. 9 - Prob. 45CRPCh. 9 - Prob. 46CRPCh. 9 - Prob. 47CRPCh. 9 - Prob. 48CRPCh. 9 - Prob. 49CRPCh. 9 - Prob. 50CRPCh. 9 - Prob. 51CRPCh. 9 - Prob. 52CRPCh. 9 - Prob. 53CRPCh. 9 - Prob. 54CRPCh. 9 - Prob. 55CRPCh. 9 - Prob. 56CRPCh. 9 - Prob. 57CRPCh. 9 - Prob. 58CRPCh. 9 - Prob. 59CRPCh. 9 - Prob. 60CRPCh. 9 - Prob. 61CRPCh. 9 - Prob. 62CRPCh. 9 - Prob. 1SICh. 9 - Prob. 2SICh. 9 - Prob. 3SICh. 9 - Prob. 4SICh. 9 - Prob. 5SICh. 9 - Prob. 6SICh. 9 - Prob. 7SICh. 9 - Prob. 8SICh. 9 - Prob. 9SICh. 9 - Prob. 10SI
Knowledge Booster
Similar questions
- For the following database scheme Employee(empNo.fName,IName,address,DOB,sex,position,deptNo) Department(deptNo.deptName,.mgrEmpNo) Project(projNo.projName,deptNo) WorksOn(empNo.projNo.dateWorked.hoursWorked) Write an SQL statement to produce a list of the total hours worked by each employee arranged in order of employee number Iarrow_forward"6.1,6.2 & 6.1 are answered" The given problem has an entity relationship diagram where the requirement is to implement the diagram in the database , insert records in the tables and then perform the sql script execution to return the result of mentioned statements. **As per Bartleby guidelines, solving the first 3 sub-parts as the question contains many parts and the required parts to be answered is not mentioned. It will involve the below steps: Converting ERD to relational schema The database will need to create below tables: **Primary key is bold and underlined, Foreign key is italic Patient(Pat_ID, Pat_Name, Pat_Age, Pat_Gender) Doctor(Doc_ID, DOc_Name, Doc_EmployDate, Prc_ID) Consultation(Doc_ID, Pat_ID, Con_Date) Practice(Prc_ID, Prc_Name, Prc_YearEstablished, Prc_Province) 6.1 Create tables in SQL Below is the script to create the tables with attributes and foreign key constraints: //Script will create the database named TrueHealth and then populate the…arrow_forward"6.1,6.2 & 6.1 are answered" The given problem has an entity relationship diagram where the requirement is to implement the diagram in the database , insert records in the tables and then perform the sql script execution to return the result of mentioned statements. **As per Bartleby guidelines, solving the first 3 sub-parts as the question contains many parts and the required parts to be answered is not mentioned. It will involve the below steps: Converting ERD to relational schema The database will need to create below tables: **Primary key is bold and underlined, Foreign key is italic Patient(Pat_ID, Pat_Name, Pat_Age, Pat_Gender) Doctor(Doc_ID, DOc_Name, Doc_EmployDate, Prc_ID) Consultation(Doc_ID, Pat_ID, Con_Date) Practice(Prc_ID, Prc_Name, Prc_YearEstablished, Prc_Province) 6.1 Create tables in SQL Below is the script to create the tables with attributes and foreign key constraints: //Script will create the database named TrueHealth and then populate the…arrow_forward
- For the following database scheme Employee(empNo,fName.IName.address.DOB.sex,position.deptNo) Department(deptNo.deptName,mgrEmpNo) Project(projNo.projName,deptNo) WorksOn(empNo.projNo.dateWorked,hoursWorked) Write an SQL statement to find all the details of employees who are femalearrow_forwardConsider an employee database with two relationsemployee (employee_name, street, city)works (employee_name, company_name, salary) where the primary keys are underlined. Write a function avg_salary that takes a company name as an argument and finds the average salary of employees at thatcompany. Then, write an SQL statement, using that function, to find companieswhose employees earn a higher salary, on average, than the average salary at“First Bank”.arrow_forwardQ2: Design Database for the following scenario and Write SQL queries. Create an ERD for the following scenario. Suppose there is a grocery store near your house. Following can be considered for ERD: A grocery store may have more than one employee. A grocery store has exactly one manager. The manager has one or more sales men working under him. Grocery store has more than one portion for the products. • Each product has a barcode, name, expired date. Many customers can busy many products, but each product is bought by only one customer. Each customer will get an invoice for his /her purchase. The bill invoice has an id.arrow_forward
- Consider the following ACTORS, FILMS and ACTEDIN relations for this problem. АСTORS FILMS SSNO FName LName YearOfBirth Gender Film FilmTitle Number Lengthin Production OfPrices Mins Yearof No 1 Bruce Willis 1955 male 1 The Sixth Sense 1999 32 107 Milla Jονοvich 1975 female 2 Sin City 2005 31 124 3 Clint Eastwood 1930 male 3 The Fifth Element 1997 126 4 Turkan Sray 1945 female 4 Unforgiven 1992 40 131 Kevin Costner 1955 male 5 A Perfect World 1993 22 138 Robert De Niro 1943 male 6. A Bronx Tale 1993 1 177 7 Yilmaz Guney 1937 male The Godfather I| 7 1974 16 202 8. Al Pacino 1940 male 8 Once Upon a Time in America 1984 13 229 9 Danny Devito 1944 male 9 One Flew Over the Cuckoo's Nest 1975 35 131 10 Jack Nicholson 1937 male 10 The Departed 2006 94 151 11 Tarik Akan 1949 male 11 The Shining 1980 3 146 12 Kadir Inanir 1949 male 12 Titanic 1997 121 194 13 Selvi Boylum Al Yazmalim 1977 90 АСТEDIN 14 Yol 1982 6 114 SSNO FilmNo Character 15 Inception 2010 148 148 1 1 Dr. Malcolm Crowe 1 2…arrow_forwardQuestion 6 In the table is joined to itself using alias to differentiate the table from itself. Right outer join a. b. Inner join Left outer join C. Recursive join d.arrow_forward3.1. As a sales agent, you have been tasked to write SQL query that searches the STOCKLIST_INFORMATION database for STOCK_ NAME values beginning with LP (LAPTOP) or CPU and their list prices. Remember that the laptop list price must be between R6000 and R9000, and the CPU speed must be either 5x2ghz or 5x3ghz. Sort the results in descending ITEM_PRICE order. 3.2. A political party agreed to present a handbag to every member of the party's women's league. Most of them want pink handbag. Several price quotes for pink purses were requested. The supplier information is not available from the normal source, but you know that the supplier identification number is embedded in the STOCK_ INFORMATION table's CATALOG URL field. You must get the STOCK_NAME and CATALOG URL values, as well as the supplier number from the CATALOG URL column, for all goods that have both the words PINK and HANDBAG contained in the STOCK_DESCRIPTION column. Hint: A typical CATALOG_URL entry looks as follows:…arrow_forward
- branch(branchhame, branch+citysassets} customer (HD, Customer name, customer street, customer city) loan loan number branch_name, amounty borrower(ID; loan_number account (account_number, branch name, balance)e depositor (HDs account number)- Figure le Consider the bank database in Figure 1, where the primary keys are underlined. Each branch might have many loans or accounts, associated with borrowers or depositors, respectively. Construct the following SQL queries for this relational database. 1. Find the name of each branch that has at least one customer who has an account in the bank and who lives in the "Harrison" city. Make sure each branch name only appears once. 2. Find the ID of each customer who lives on the same street and in the same city as customer "12345". (1) Please use "tuple variables". e (2) Please use "derived relations" or “with". 3. Find the ID of each customer of the bank who has an account but not a loan. 4. Find the total sum of all loan amounts for each branch…arrow_forwardDatabase Systems SQLarrow_forwardA manager has a list of items that have been sorted according to an item ID. Some of them are duplicates. She wants to add a code to the database that assigns a 1 to the item if it is unique, and if there are duplicates, assigns the number of the duplicate. An example is shown below. The first two items are unique, so the repeat code is 1. However, Item ID 37695 is listed six times, so the codes are assigned from 1 to 6, and so on. Explain how to assign the correct code using an IF statement Item ID Repeat Code35080 135222 137695 137695 237695 337695 437695 537695 637712 137722 137757 137757 2 In cell B2 enter 1, and then type a formula into cell B3, followed by dragging the formula down column B until it aligns with the last row in the Item ID column. Which of the following is the correct formula to type into cell B3?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education