Bundle: Database Systems: Design, Implementation, & Management, Loose-leaf Version, 12th + Lms Integrated For Mindtap Computing, 1 Term (6 Months) Printed Access Card
12th Edition
ISBN: 9781337129992
Author: Coronel
Publisher: CENGAGE L
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 7, Problem 12P
Write the SQL code that will change the PROJ_NUM to 14 for employees who were hired before January 1, 1994, and whose job code is at least 501. (You may assume that the table will be restored to its condition preceding this question.)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write the SQL code that will change the PROJ_NUM to 14 for employees who were hired before January 1, 1994, and whose job code is at least 501. When you finish Problems 7–15, the EMP_2 table will contain the data shown in Figure P8.15.
Use the following tables to write the SQL queries:
Table Name: Employees
Write SQL Command to
display employee first
name , salary and new
column called Degree.
Evaluate the new column
data based on the following
EMPLOYEE_ID
FIRST_NAME
HIRE DATE
JOB_ID
SALARY
DEPARTMENT_ID
100
Steven
02/13/2008
AD PRES
24000
90
101
Neena
05/20/2010
AD_VP
17000
90
102
Lex
09/11/2013
AD VP
17000
90
103
Alexander
09/01/2010
IT PROG
9000
60
104
Bruce
01/17/2012
IT PROG
6000
60
02/21/2018
conditions:
105
David
IT PROG
4800
60
If salary is more than 20000
then Degree is PHD
If salary is more than 10000
then Degree is
106
Vali
10/04/2018
IT PROG
4800
60
107
Diana
10/06/2019
IT PROG
4200
60
114
Den
08/05/2015
PU_MAN
11000
30
115
Alexander
01/14/2016
PU CLERK
3100
30
Table Name: Departments
Table Name: Locations
DEPARTMENT_ID
DEPARTMENT_NAME
LOCATION_ID
LOCATION_ID
POSTAL_CODE
CITY
COUNTRY_ID
10
Administration
1700
1400
26192
Southlake
US
30
Purchasing
1700
1500
99236
South San Francisco
US
50
Shipping
1500…
Using the Online SQL Editor, answer the following questions with screenshots.
Link: https://www.programiz.com/sql/online-compiler/
1. Show all columns from Order table then add a new column titled “Lowest Price”, where such column flags or labels all amounts less than or equal to 300 as “Items 300 and below”. Answer(screenshot of code & output from SQL Editor)
2. Show last name, first name, and age columns from Customers table then add a new column titled “Age Label”,where such column flags or labels all ages 25 and above as “Tigulang na” and ages below 25 as “Bata pa ah”. Answer(screenshot of code & output from SQL Editor)
3. Provide the order id, item and sum (amount) of all items with a total (sum) amount greater than 400; rename the sum (amount) column as “Total Amount”; then group the result by order_id. Answer(screenshot of code & output from SQL Editor)
4. Show the customer id, last name, and first name of all customers who ordered items with an amount greater than…
Chapter 7 Solutions
Bundle: Database Systems: Design, Implementation, & Management, Loose-leaf Version, 12th + Lms Integrated For Mindtap Computing, 1 Term (6 Months) Printed Access Card
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
- Write the SQL code to delete the row for William Smithfield, who was hired on June 22, 2004, and whose job code is 500. (Hint: Use logical operators to include all of the information given in this problem.)arrow_forwardStore Table.png → „By using SQL language return the items and their total number of units that have been ordered (except pens of various kinds) For the part of table "Store" show below, answer the following: Store id Order date Region Representative Item Units Unit cost Total 1 1/6/2018 East Jones Pencil 95 1.99 189.05 4 2/9/2019 Central Jardine Pencil 36 4.99 179.64 9 5/5/2019 Central Jardine Pencil 90 4.99 449.1 10 5/22/2019 West Thompson Pencil 32 1.99 63.68 11 6/8/2019 East Jones Binder 60 8.99 539.4 6/25/2019 06 29 12 Central Morgan Pencil 4.99 449.1 13 7/12/2019 East Jardine Binder 1.99 57.71 14 7/29/2019 East Parent Binder 81 19.99 1619.19 16 9/1/2019 Central Smith Desk 125 250 19 10/22/2019 East Jones Pen 64 8.99 575.36 22 12/12/2019 Central Smith Pencil 67 1.29 86.43 23 12/29/2019 East Parent Pen Set 74 15.99 1183.26 25 12/1/2020 Central Smith Ink Pen 87 15 1305 2.arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST NAME SUR NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female B 35 NO Negative SELECT SUM (weight) FROM patients WHERE pcr test= 'Positive'; Answer:arrow_forward
- Use the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST NAME SUR NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female B Negative 35 NO SELECT NULLIF(phone, fax) FROM patients WHERE medical no = 1001; Answer:arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST NAME SUR_NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male Negative 91122544 AB 66 YES 1005 Shamsa Alfahdi 15-Sep-2002 Female 35 NO Negative SELECT NULLIF(phone, fax) FROM patients WHERE medical no = 1001; Answer:arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST_NAME SUR_NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB Negative 66 YES 1005 Shamsa Alfahdi 15-Sep-2002 Female B 35 NO Negative SELECT INSTR(first name, 'h') FROM patients WHERE medical no = 1002; Answer:arrow_forward
- Using 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. EMP_NUM 101 103 104 105 108 113 115 117 EMP_LNAME News Arbough Ramoras Johnson Washington Joenbrood Bawangl Williamson SumOfASSIGN HOURS 3.1 19.7 11.9 12.5 8.3 3.8 12.5 18.8 SumOfASSIGN_CHARGE 387.50 1664.65 1218.70 1382.50 840.15 192.85 1276.75 649.54arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL NO FIRST_NAME SUR NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male 78 VES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female 35 NO Negative SELECT TO CHAR (DOB, 'Mon-DD-YY') FROM patients WHERE Medical no-1001; Answer: 12-Jun-2001arrow_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
- Write SQL queries to answer the following questions:a. Which studen ts have an ID number that is less than50000?b. What is the name of the faculty member whose ID is4756?c. What is the smallest section number used in the firstsemester of 2018arrow_forwardWrite SQL code that returns the EMP_NUM and Number of ratings he/she earned (based on EARNEDRATING table, call this Num_RTG), for those who had at least got 1 rating earned, but the number of ratings he/she earned must lower than the average number of ratings for all employees who had earned ratings before, and such employee has been served as “Copilot” before.arrow_forwardUsing the Online SQL Editor, answer the following questions with screenshots. Link: https://www.programiz.com/sql/online-compiler/ Question 1: Show (in one table) customer id and first name from Customers table together with shipping id and status from Shippings table while assigning them, within the SQL code, the aliases CT and ST, respectively. *CT for Customers table and corresponding columns*ST for Shippings table and corresponding columns Question 2: Show customer id, item, and amount from Orders table together with the last name and age from Customers table whose age is 25 and above. Question 3: Create a new table named Suppliers, with the following columns: Supplier id, first name, last name, age, and country. Limit first name and last name to 40 characters, country to 15 characters, and age to 3 characters.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database 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 LearningA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
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
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY