Computer Science
Chapter 7 Introduction to Structured Query Language Questions Assignment

Question Description

Help me study for my Computer Science class. I’m stuck and don’t understand.

answer the following questions in the world documentations feel free to ask when it is not clear.







thanks

Unformatted Attachment Preview

Chapter 7 An Introduction to Structured Query Language (SQL) Chapter 7 Lab Assignment Introduction to Structured Query Language (SQL) 1. In a SQL query, what is the difference between a WHERE clause and a SELECT clause? 2. Rewrite the following WHERE clause without the use of the IN special operator. WHERE V_STATE IN (‘TN’, ‘FL’, ‘GA’) 3. Explain the difference between an ORDER BY clause and a GROUP BY clause. 4. Explain why the two following commands produce different results. SELECT DISTINCT COUNT (V_CODE) FROM PRODUCT; SELECT COUNT (DISTINCT V_CODE) FROM PRODUCT; 5. What is the difference between the COUNT aggregate function and the SUM aggregate function? Chapter 7 An Introduction to Structured Query Language (SQL) Figure P7.1 Structure and contents of the Ch07_ConstructCo database Note that the ASSIGNMENT table in Figure P7.1 stores the JOB_CHG_HOUR values as an attribute (ASSIGN_CHG_HR) to maintain historical accuracy of the data. The JOB_CHG_HOUR values are likely to change over time. In fact, a JOB_CHG_HOUR change will be reflected in the ASSIGNMENT table. And, naturally, the employee primary job assignment might change, so the ASSIGN_JOB is also stored. Because those attributes are required to maintain the historical accuracy of the data, they are not redundant. Chapter 7 An Introduction to Structured Query Language (SQL) 1. Write the SQL code to enter the first two rows. 2. Assuming the data shown in the EMP_1 table have been entered, write the SQL code that will list all attributes for a JOB_CODE of 502. 3. Write the SQL code to delete the row for the person named William Smithfield, who was hired on June 22, 2004, and whose job code classification is 500. (Hint: Use logical operators (AND) to include all of the information given in this problem.) Chapter 7 An Introduction to Structured Query Language (SQL) 4. Write the SQL code required to list all employees whose last names start with Smith. In other words, the rows for both Smith and Smithfield should be included in the listing. Assume case sensitivity. 5. Write the SQL code that will produce a listing for the data in the EMP_1 table in ascending order by the EMP_LNAME. 6. Write the SQL code that will list only the distinct job codes found in the EMP_1 table. ...
Purchase answer to see full attachment
Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

Done thanks and welcome

Chapter 7 An Introduction to Structured Query Language (SQL)

Chapter 7
Lab Assignment
Introduction to Structured Query Language (SQL)
1. In a SQL query, what is the difference between a WHERE clause and a SELECT clause?
In SQL, the WHERE clause is used in eliminating rows before any aggregate function is applied.
WHERE clause cannot contain the Aggregate function for example
SELECT COUNT(SalesOrderID)
FROM Sales.SalesOrderDetail
WHERE UnitPrice < 200

HAVING clause on the other hand helps in filtering records on the basis of the Aggregate functions.
For example the HAVING clause cannot be used without GROUP BY
2. Rewrite the following WHERE clause without the use of the IN special operator.
WHERE V_STATE IN (‘TN’, ‘FL’, ‘GA’)

Now rewrite the given query without use of the IN operator then follows:
where
V_STATE = 'TN' AND V_STATE = 'FL' AND V_STATE='GA'
where
V_STATE LIKE 'TN' AND V_STATE LIKE 'FL' AND V_STATE LIKE 'GA'
3. Explain the difference between an ORDER BY clause and a GROUP BY clause.
An ORDER BY clause has no impact on which rows are returned by the query; it simply sorts those
rows into the specified order. A GROUP BY clause does impact the rows that are returned by the
query. A GROUP BY clause gathers rows into collections that can be acted on by aggregate
functions.

4. Explain why the two following commands produce different results.
SELECT DISTINCT COUNT (V_CODE) FROM PRODUCT;
SELECT COUNT (DISTINCT V_CODE) FROM PRODUCT;

Chapter 7 An Introduction to Structured Query Language (SQL)

This query will first execute COUNT(V_CODE) which will return a single value. Then the DISTINCT
will be applied to that single value. Which means it will display the same value again.
SELECT COUNT (DISTINCT V_CODE)...

DrLicklider (250)
University of Maryland

Anonymous
The tutor managed to follow the requirements for my assignment and helped me understand the concepts on it.

Anonymous
The tutor was knowledgeable, will be using the service again.

Anonymous
Awesome quality of the tutor. They were helpful and accommodating given my needs.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4