answersLogoWhite

0


Best Answer

Yes, you can use a having clause and a where clause together in an SQL query. select emp_dept, sum(value) total_value, count(1) sales

from all_sales

where emp_dept in ('fashions','stereos','cosmetics')

group by emp_dept

having sum(value) > 125000

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a having clause and a where clause be used together in a SQL query?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between Script and Query?

Script is a term used to describe programs that aren't compiled (that is, turned into 1's and 0's) first. A scripting engine reads the code exactly how you wrote it, and turns it into a computer program on the fly. Query is just a fancy word for question, but on the web it generally means "SQL Query." An SQL query is a way of asking a database for information, that follows the Structured Query Language syntax. All SQLs are a bit off of the actual SQL standard, and you have to work with whatever version your relational database (RD) supports.


What is Object Query Language OQL?

OQL is a database query language(related to ODMG) that is based on SQL and supports the adding, retrieving, querying, and invocation of objects. OQL is a version of the Structured Query Language. A object query language that supports complex data types such as multimedia, spatial, compound documents, etc., that are stored as objects. Standard SQL queries can still be used, and the OQL server process converts the objects into relational views. Sanjay


What is a special language used to write computer programs?

SQL which stands for Structured Query Language The term you are looking for is programming language.


Will aluminum contaminate stainless steel if used together?

No. Stainless Steel will resist contamination from the aluminum when they are used together.


Does standard SQL allow built in functions to be used in a WHERE clause?

Yes. Example: Select `Id`,`Name` From `Order` Where `OrderDate` = CURDATE() And `IsShipped` = False

Related questions

Which clause should be used to restrict groups returned by a grouped query?

Having


What is the Select Top clause?

The Select Top clause is a programming command used with SQL or Structured Query Language. SQL is one of the main languages used in managing databases. The Select Top clause is used to specify the number of records to return from a query on the database.


What SQL clause is used to restrict the rows returned by a query?

The WHERE clause is used to restrict the rows returned by a query in SQL. It allows you to specify a condition that must be met for a row to be included in the result set.


What is the difference between the where and having sql clauses?

The short answer is that the WHERE clause is used for comparing values in the base table, whereas the HAVING clause can be used for filtering the results of aggregate functions in the result set of the query. SELECT * FROM tablename WHERE ID > 100 ...is an example of a WHERE clause. Here's a simple example of a HAVING clause that returns the count of workers with the same last names... SELECT WorkerLastName, COUNT(WorkerLastName) AS WorkerCount FROM tblWorker GROUP BY WorkerLastName HAVING COUNT(WorkerLastName) > 1 The HAVING clause allows you to filter the results of aggregate functions, such as COUNT() or AVG() or SUM(), or MAX() or MIN(), just to name a few. HAVING provides you a means to filter these results in the same query, as opposed to saving the results of a WHERE clause SQL statement to a temporary table and running another query on the temporary table results to extract the same results. To do the HAVING SQL above without the HAVING clause would require the following SQL: SELECT WorkerLastName, COUNT(WorkerLastName) AS WorkerCount INTO TempTable FROM tblWorker GROUP BY WorkerLastName SELECT * FROM TempTable WHERE WorkerCount > 1 DROP TABLE TempTable


Can you use query language to extrapolate information from a database?

Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.Yes. That is one of the things that a query is used for.


Give example for showing the difference between having and where clause?

having Clasue is used post to Group By where the group by will done first and after that condition is applied. Where Clause has been done on each and every Row after that the Group by will Occur


What is mean by dynamic query?

A query is an SQL statement that is used to retrieve or modify data from database. A query that works dynamically is called dynamic query.


How can you use break in a complex sentence?

Complex sentences are made by joining clauses together by either subordination or coordination. So the sentence consists of a main clause and a subordinate or coordinate clausesubordinate clause: We will phone you after the Easter break. There are different types of subordinate clauses -- after the Easter break is an adverbial clause. The main clause is We will phone you.and/or/but can be used to make coordinating complex sentences:We were just having a break and the rain started. The rain started is a coordinate clause, the main clause is we were just having a break.


What are the uses of a Query?

In MS Access, a Query is a saved search, which can be used in reports, etc.


What is mean by dynamics?

A query is an SQL statement that is used to retrieve or modify data from database. A query that works dynamically is called dynamic query.


What is dynamic mean?

A query is an SQL statement that is used to retrieve or modify data from database. A query that works dynamically is called dynamic query.


When do you perform denormalization?

Generally to optimize the performance of select query. To minimize joins used in the query.