Question

Information System Question - SQL ----------------------------------------------------------- What will be returned when the following SQL statement is...

Information System Question - SQL

-----------------------------------------------------------

What will be returned when the following SQL statement is executed? SELECT driver_no, count(*) AS num_deliveries FROM deliveries WHERE state = 'MA' GROUP BY driver_no;

----------------------------------------------------------

Please explain why the answer is B. Thank you.

---------------------------------------------------------

A.

B. A listing of each driver who made deliveries to state = 'MA' as well as the number of deliveries that each driver has made to that state.

C.

D.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The GROUP BY statement group rows that have the same values into summary rows.

So, The given query groups the rows that have the same value of attribute "driver_no" in the state of 'MA'.
And then count(*) is used to count the number of rows per each driver_no

Add a comment
Know the answer?
Add Answer to:
Information System Question - SQL ----------------------------------------------------------- What will be returned when the following SQL statement is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Top of Form Q1 Which of the following is a valid aggregate function in SQL? Check...

    Top of Form Q1 Which of the following is a valid aggregate function in SQL? Check only those that apply. Question 1 options: AVG LEAST COUNT MIN MOST SUM Q2 Which of the following aggregate functions will only operate on a numeric value expression? Check only those that apply: Question 2 options: MIN MAX AVG COUNT SUM Q3 When applying DISTINCT to the value being calculated in an aggregate function like COUNT, what is the effect? SELECT COUNT(DISTINCT StreetName) FROM...

  • Question 10 (1 point) 10. If the following SQL statement is executed, what should be the...

    Question 10 (1 point) 10. If the following SQL statement is executed, what should be the query result? select ID, Name from Student where Hometown "San Antonio" D) Gina Lauren C) 1002 Gina 1004 Lauren B) Null A) San Antonio Question 7 (1 point) Saved Using the Student table, as shown below, to answer question 7 to 10 Name ID Grade Hometown Eric 1001 A Dallas Gina 1002 B San Antonio Eric 1003 Seattle Lauren 1004 A San Antonio Kathy...

  • SQL and Databases, please help During an interview, you are asked to explain the result of...

    SQL and Databases, please help During an interview, you are asked to explain the result of the following query: SELECT S.sname, s.rating, MIN(S.age) FROM Sailors 5 WHERE S.age > 18 GROUP BY S.rating HAVING COUNT(*) > 1; What is the right answer? This query is not functional since sname is not in the GROUP BY list. Find the age of the sailors who have at least two rating and older than 18 years old. Find the ratings and ages of...

  • 7.13. Consider the following View definition and update statement: CREATE VIEW TOPPRODUCTS(PRODNR,PRODNAME,QUANTITY) AS SELECT PRODNR, PRODNAME,...

    7.13. Consider the following View definition and update statement: CREATE VIEW TOPPRODUCTS(PRODNR,PRODNAME,QUANTITY) AS SELECT PRODNR, PRODNAME, AVAILABLE_QUANTITY FROM PRODUCT WHERE AVAILABLE_QUANTITY>100 WITH CHECK OPTION UPDATE TOPPRODUCTS SET QUANTITY=80 WHERE PRODNR=0153 What will be the result of this? a. The update can be successfully made but only the PRODUCT table will be updated. b. The update can be successfully made and both the View and PRODUCT table will be updated. c. The update will be halted because of the WITH CHECK...

  • What happens when you try to compile and run the following code? String query = "INSERT...

    What happens when you try to compile and run the following code? String query = "INSERT INTO Invoices (InvoiceDate InvoiceTotal) "              + "VALUES ('2/10/01', '443.55')"; Statement statement = connection.createStatement(); statement.executeUpdate(query); a. A SQLException is thrown at runtime because the executeUpdate method can’t accept a String object. b. A SQLException is thrown at runtime because the SQL statement is coded incorrectly. c. An error occurs at compile time because the SQL statement is coded incorrectly. d. This code compiles and...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • For the questions below, write the SQL statement and also answer the question if requested. You n...

    Thumbs up for the Correct answer with all steps For the questions below, write the SQL statement and also answer the question if requested. You need to show the execution result of each SQL statement. 1. Create a sequence object (named with SalespersonIDSeq) which starts with 11, is increased by 1 with nocycle 2. Insert two new salesperson records below into Salesperson _T table. number generated using SalespersonIDSeq object For SalespersonID, use a sequence <SalespersonName: Brandon Young, SalespersonCity: Fort Wayne,...

  • The following SQL query returns one row per surgeon. The granularity before GROUP BY is a surgeon-panel combination, in...

    The following SQL query returns one row per surgeon. The granularity before GROUP BY is a surgeon-panel combination, in other words, for each surgeon, one panel they performed in. Surgeons can only be listed once per panel, but a log can have more than one panel. SELECT staff.STAFF_NM_WID "surgeon", COUNT( orl.LOG_ID ) "Number of Logs" FROM OR_LOG orl INNER JOIN V_LOG_STAFF staff ON orl.LOG_ID = staff.LOG_ID INNER JOIN OR_LOG_ALL_PROCS procs ON orl.LOG_ID = procs.LOG_ID AND procs.LINE = 1 --First Listed...

  • (TCO 7) Write a JOIN to display the instructor first and last names and the course...

    (TCO 7) Write a JOIN to display the instructor first and last names and the course description for the course the instructor is teaching Student Instructor Zipcode PK Student ID PK Instructor ID PK Zip Salutation First Name Last Name Street Address Phone Employer Registration Date Salutation First_Name Last_Name Street Address City State FK1 Zip FK1 Zip Section PK Section ID Course Course Section_Num Enrollment Start Date_Time Location PK Course ID PK,FK1 Section ID PK,FK2 Student ID Capacity FKI |...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT