Which two statements are true about WHERE and HAVING clause ?
Which two statements are true about WHERE and HAVING clause ?
1. WHERE clause can be used to restict rows only
2.HAVING clause can be used to restrict groups only
3.HAVING clause can be used to restrict groups and rows
Plz help me in dis ques...which two will be correct...i think its 1 and 2...but not sure.
863180 wrote:
Plz help me in dis ques...which two will be correct...i think its 1 and 2...but not sure.If you are not sure then you do not fully understand HAVING.
SY.
Similar Messages
-
Use of Where and having clause
Hi all,
I always have a doubt about use of HAVING and WHERE clause,
suppose I have table T1 with only one column C1
CREATE TABLE T1
(C1 VARCHAR2(1) );
which having data by following INSERT scripts
INSERT INTO T1 VALUES('A');
INSERT INTO T1 VALUES('B');
INSERT INTO T1 VALUES('C');
INSERT INTO T1 VALUES('A');
INSERT INTO T1 VALUES('B');
INSERT INTO T1 VALUES('A');
Now I want result as follows
C1 ==== COUNT(C1)
==============
B ===== 2
A ===== 3
So out of query 1 and 2 which approach is right ?
1) SELECT C1,COUNT(C1) FROM T1
WHERE C1<>'C'
GROUP BY C1
ORDER BY C1 DESC;
2) SELECT C1,COUNT(C1) FROM T1
GROUP BY C1
HAVING C1<>'C'
ORDER BY C1 DESC;
Edited by: user13306874 on Jun 21, 2010 2:36 AMIn SQL, it's always best to filter data at the earliest moment possible.
In your example the WHERE clause would be that moment:
SQL> explain plan for
2 select c1,count(c1)
3 from t1
4 where c1 != 'C'
5 group by c1
6* order by c1 desc;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3946799371
| Id | Operation | Name | Rows | Bytes |
| 0 | SELECT STATEMENT | | 5 | 10 |
| 1 | SORT GROUP BY | | 5 | 10 |
|* 2 | TABLE ACCESS FULL| T1 | 5 | 10 |
Predicate Information (identified by operation id):
2 - filter("C1"!='C')
18 rows selected.
SQL>As you can see the filter is applied during the scan of T1.
Whereas in the HAVING case:
SQL> explain plan for
2 select c1,count(c1)
3 from t1
4 group by c1
5 having c1 != 'C'
6* order by c1 desc;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3146800528
| Id | Operation | Name | Rows | Bytes |
| 0 | SELECT STATEMENT | | 6 | 12 |
|* 1 | FILTER | | | |
| 2 | SORT GROUP BY | | 6 | 12 |
| 3 | TABLE ACCESS FULL| T1 | 6 | 12 |
Predicate Information (identified by operation id):
1 - filter("C1"!='C')
18 rows selected.
SQL>The scan is done after all groups have been computed: one of which was computed in vain, since it will be filtered away due to the HAVING clause.
In general I would use as a guideline: if you are not using aggregate functions in your HAVING clause predicate, then move that predicate to the WHERE portion of your query.
Edited by: Toon Koppelaars on Jun 21, 2010 11:54 AM -
Which of this is true about class and object?
(a) A class is made of objects
(b) A class is a collection of objects
(c) A class supplies or delivers objects to the rest of the application
(d) A class is used as a template to create objects
(e) An object inherits its variables and their values from its class
(f) An object inherits its variables and methods from its class
(g) An object inherits its variables and methods from its class and its superclasses
(h) The variables and methods of a class are defined in its objects
(i) The variables and methods of an object are defined in its class
(j) The variables, variable values and methods of an object are given in its class(a) A class is made of objects - true
(b) A class is a collection of objects - true
(c) A class supplies or delivers objects to the rest of the application - true
(d) A class is used as a template to create objects - true
(e) An object inherits its variables and their values from its class - false
(f) An object inherits its variables and methods from its class - true
A class is a not collection of objects. A class not only contains objects
A class represents objects and others. -
Which of the following are true about abstract methods in EJB 2.0
Hi guys I'm beginner to EJB and i got some unanswered questions.
Can any one of you please.. give answers?
Thanks if you do...
Which of the following are true about abstract methods in EJB 2.0
CMP?
Choose all correct answers:
1. Abstract accessor methods should not be exposed in the EJB
component's interface
2.Abstract accessor/mutator methods are used to access and modify
persistent state and relationship information for entity objects
3.Abstract Accessor/Mutator methods do not throw exceptions
4.The EJB developer must implement the Accessor/Mutator methods
5.Abstract accessor methods may or may not be exposed in the EJB
component's interface
2.Which ONE of the following is true?
Choose the best answer:
1.Local interfaces cannot have a relationship with other Entity
components
2.Local interfaces cannot be used for Stateless Session EJB
3.Local interfaces can be a part of Object's persistent state
4.Local interfaces have the same functionality as that of a
stateless Session EJB
3.Which of the following describe the <cmr-field> in a EJB 2.0
descriptor?
Choose all correct answers:
1.A Local interface/Entity can be a value of a <cmr-field>
2.There is no <cmr-field> in EJB 2.0 descriptor
3.It is used to represent one meaningful association between any
pair of Entity EJBs, based on the business logic of the Application
4.It provides a particular mapping from an object model to a
relational database schema
5.It allows the Local Entity interfaces to participate in
relationships
4.Which of the following are the advantages of using Local interfaces
instead of dependent value classes?
Choose all correct answers:
1.Local Entity Interfaces can participate in Relationships
2.The life cycle of Local Entity Interfaces is managed by EJB
container, intelligently
3.Local Entity Interfaces can be used in EJB QL Queries
4.Local Entity Interfaces can be a part of the <cmp-field> but not
<cmr-field>
5.Which of the following are true about Local interfaces
1.A local interface must be located in the same JVM to which the EJB
component is deployed
2.Local calls involve pass-by-reference.
3.The objects that are passed as parameters in local interface
method calls must be serializable.
4.In general, the references that are passed across the local
interface cannot be used outside of the immediate call chain and must
never be stored as part of the state of another enterprise bean.
6.Which of the following specifies the correct way for a client
to access a Message driven Bean?
Choose the best answer:
1. via a Remote interface
2. via Home interface
3. Message driven bean can be accessed directly by the client
4. both 1 & 2
5. none of the above
------------------------------------------------------------------------7.Which of the following statements are true about message-driven
bean Clients?
------------------------------------------------------------------------Choose all correct answers:
They can create Queue and QueueConnectionFactory objects
They can create Topic and TopicConnectionFactory objects
They can lookup the JNDI server and obtain the references for
Queue and Topic and their connection Factories
Only 1 and 2 aboveHi guys I'm beginner to EJB and i got some unanswered
questions.
Can any one of you please.. give answers?
Thanks if you do...
Which of the following are true about abstract methods
in EJB 2.0
CMP?
Choose all correct answers:
1. Abstract accessor methods should not be exposed
d in the EJB
component's interfacefalse
2.Abstract accessor/mutator methods are used to
access and modify
persistent state and relationship information for
entity objectstrue
>
3.Abstract Accessor/Mutator methods do not throw
exceptionstrue
>
4.The EJB developer must implement the
Accessor/Mutator methodsfalse
5.Abstract accessor methods may or may not be exposed
in the EJB
component's interfacetrue
2.Which ONE of the following is true?
Choose the best answer:
1.Local interfaces cannot have a relationship with
other Entity
componentsfalse
2.Local interfaces cannot be used for Stateless
Session EJBfalse
3.Local interfaces can be a part of Object's
persistent statefalse
4.Local interfaces have the same functionality as
that of a
stateless Session EJBtrue
3.Which of the following describe the <cmr-field> in a
EJB 2.0
descriptor?
Choose all correct answers:
1.A Local interface/Entity can be a value of a
<cmr-field>true
2.There is no <cmr-field> in EJB 2.0 descriptorfalse
3.It is used to represent one meaningful association
between any
pair of Entity EJBs, based on the business logic of
the Applicationtrue
4.It provides a particular mapping from an object
model to a
relational database schematrue
5.It allows the Local Entity interfaces to
participate in
relationshipstrue
4.Which of the following are the advantages of using
Local interfaces
instead of dependent value classes?
Choose all correct answers:
1.Local Entity Interfaces can participate in
Relationshipsis
2.The life cycle of Local Entity Interfaces is
managed by EJB
container, intelligentlyis
3.Local Entity Interfaces can be used in EJB QL
Queriesnot
4.Local Entity Interfaces can be a part of the
<cmp-field> but not
<cmr-field>not
>
>
5.Which of the following are true about Local
interfaces
1.A local interface must be located in the same JVM
M to which the EJB
component is deployedtrue
2.Local calls involve pass-by-reference.true
3.The objects that are passed as parameters in local
l interface
method calls must be serializable.false
4.In general, the references that are passed across
s the local
interface cannot be used outside of the immediate
e call chain and must
never be stored as part of the state of another
r enterprise bean.true
>
6.Which of the following specifies the correct way for
a client
to access a Message driven Bean?
Choose the best answer:
1. via a Remote interfacefalse
2. via Home interfacefalse
3. Message driven bean can be accessed directly by
the clientfalse
4. both 1 & 2false
5. none of the abovetrue.
>
----------------7.Which of the following statements
are true about message-driven
bean Clients?
----------------Choose all correct answers:
They can create Queue and QueueConnectionFactory
objectsthe container can, dunno bout clients
>
They can create Topic and TopicConnectionFactory
objectsthe container can, dunno bout clients
>
They can lookup the JNDI server and obtain the
references for
Queue and Topic and their connection Factories
true
Only 1 and 2 abovefalse
somebody correct me if i'm wrong -
Which two statements about custom catalogs are true
Which two statements about custom catalogs are true? (Choose two.)
A. A category cannot contain catalogs.
B. Catalogs can contain one or more subcatalogs.
C. A product can only belong to one category.
D. Each category exists in one and only one catalog.
thanksHi,
Which two statements about custom catalogs are true? (Choose two.)
A. A category cannot contain catalogs. -> FALSE
B. Catalogs can contain one or more subcatalogs. -> TRUE
C. A product can only belong to one category.-> FALSE
D. Each category exists in one and only one catalog.->FALSE
To my knowledge, it seems only one of these is true.
Thanks,
Gopinath Ramasamy -
Which two statements define a Static Record Group?
Hi all
I read this question and I do not know the answer
the question is
Which two statements define a Static Record Group? (Choose two)
A. The Record Group can be created only at run time.
B. The Record Group is not associated with a query.
C. The Record Group can be created and modified only at design time.
D. The Record Group can be created and modified at design time or at run time.
E. You can modify the structure of this Record Group by adding columns and rows at run time.
F. You can modify the structure of this Record Group by associating it with a query at run time.Types of record group, either Static or Query:
Static Specifies that the record group is constructed of explicitly defined column names and column values.
The values of a static record group are specified at design time and cannot be changed at runtime.
Query Specifies that the record group is associated with a SELECT statement, and thus can be populated dynamically at runtime.
When you select this option, enter the SELECT statement in the multi-line field provided, then choose Apply.
So answers B and C
From Forms Help -
BPC 7 MS: Which SQL statements are created for writing with input schedule?
Hi,
I wanted to know which SQL statements are created and executed if a user submits values using an Excel input schedule to an application.
When I check the correspoinding MS SQL server log files, I see that data is read from the three partitions belonging to the application and put into a temporary table, but I can't find anything about writing back to the application (presumably the WB partiton...) in the log.
There are some cryptic entries in the log file as well, but they are not human-readale... are there any BPC logfiles that could tell me which SQL statements are created and executed to write back the new values to the application? Thanks!Hi,
As far as i know, when a user send data entry from an excel schedule, it will be written in the WB table of the application (for each application, you have 3 Data tables : WB, Fact2 and Fact).
I presume that the SQL statement may be an INSERT or UPDATE statement.
Technically, the update is done by the send governor service (hosted on your BPC application server).
There is no log that will show you the SQL Statement besides a SQL trace that you have to setup in SQL Server 2005 Manager Studio.
btw, the data are written in the Relationnal database but are read from the OLAP cube. The olap Cube is split in 3 partitions (ROLAP on WB table / and MOLAP on fact and fat2). Wich mean that every new entry in WB will be automatically "updated" in the cube.
Some DM packages can directly write data in fact2 table. In this case you need to reprocess the cube to get it loaded. -
Group by clause and having clause in select
hi frnds
plz give me some information of group by and having clause used in select statement with example
thanksThe Open SQL statement for reading data from database tables is:
SELECT <result>
INTO <target>
FROM <source>
[WHERE <condition>]
[GROUP BY <fields>]
[HAVING <cond>]
[ORDER BY <fields>].
The SELECT statement is divided into a series of simple clauses, each of which has a different part to play in selecting, placing, and arranging the data from the database.
You can only use the HAVING clause in conjunction with the GROUP BY clause.
To select line groups, use:
SELECT <lines> <s1> [AS <a1>] <s2> [AS <a2>] ...
<agg> <sm> [AS <am>] <agg> <sn> [AS <an>] ...
GROUP BY <s1> <s2> ....
HAVING <cond>.
The conditions <cond> that you can use in the HAVING clause are the same as those in the SELECT clause, with the restrictions that you can only use columns from the SELECT clause, and not all of the columns from the database tables in the FROM clause. If you use an invalid column, a runtime error results.
On the other hand, you can enter aggregate expressions for all columns read from the database table that do not appear in the GROUP BY clause. This means that you can use aggregate expressions, even if they do not appear in the SELECT clause. You cannot use aggregate expressions in the conditions in the WHERE clause.
As in the WHERE clause, you can specify the conditions in the HAVING clause as the contents of an internal table with line type C and length 72.
Example
DATA WA TYPE SFLIGHT.
SELECT CONNID
INTO WA-CONNID
FROM SFLIGHT
WHERE CARRID = 'LH'
GROUP BY CONNID
HAVING SUM( SEATSOCC ) > 300.
WRITE: / WA-CARRID, WA-CONNID.
ENDSELECT.
This example selects groups of lines from database table SFLIGHT with the value LH for CARRID and identical values of CONNID. The groups are then restricted further by the condition that the sum of the contents of the column SEATSOCC for a group must be greater than 300.
The <b>GROUP BY</b> clause summarizes several lines from the database table into a single line of the selection.
The GROUP BY clause allows you to summarize lines that have the same content in particular columns. Aggregate functions are applied to the other columns. You can specify the columns in the GROUP BY clause either statically or dynamically.
Specifying Columns Statically
To specify the columns in the GROUP BY clause statically, use:
SELECT <lines> <s1> [AS <a 1>] <s 2> [AS <a 2>] ...
<agg> <sm> [AS <a m>] <agg> <s n> [AS <a n>] ...
GROUP BY <s1> <s 2> ....
To use the GROUP BY clause, you must specify all of the relevant columns in the SELECT clause. In the GROUP BY clause, you list the field names of the columns whose contents must be the same. You can only use the field names as they appear in the database table. Alias names from the SELECT clause are not allowed.
All columns of the SELECT clause that are not listed in the GROUP BY clause must be included in aggregate functions. This defines how the contents of these columns is calculated when the lines are summarized.
Specifying Columns Dynamically
To specify the columns in the GROUP BY clause dynamically, use:
... GROUP BY (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters containing the column names <s 1 > <s 2 > .....
Example
DATA: CARRID TYPE SFLIGHT-CARRID,
MINIMUM TYPE P DECIMALS 2,
MAXIMUM TYPE P DECIMALS 2.
SELECT CARRID MIN( PRICE ) MAX( PRICE )
INTO (CARRID, MINIMUM, MAXIMUM)
FROM SFLIGHT
GROUP BY CARRID.
WRITE: / CARRID, MINIMUM, MAXIMUM.
ENDSELECT.
regards
vinod -
Content Server - Which SQL statements are running?
Hi sap lovers! Does anyone aware of which sql statements being run on the maxDB part when, e.g saving a document (or retrieving a document) (on the ABAP part) within our DMS landscape?
And at the whole, Is It possible to monitor sqls running on MAXDB, like we can see in ST04
-> Oracle Session
Regards,
VladimirYou can find that out doing the following:
- on any ABAP system start DB59
- enter the data to connec to the content server database
- doubleclick on the made entry so you get in "DB50 for remote databases"
- switch on the command monitor
- then use the task manager and press on "running commands"
Markus -
anyone know how to get mail to show the photos back to you?
ex: send pictures to friends, they reply w/ comments, but have no idea which pictures they are commenting on because they do not sho up in a reply.
thanks for your helpDid you ever get a reply to this. I have the same problem. I have the same problem when even when I reply to an email... no photo shows up in my new reply message. The only way I have figured out is to use the "forward" option.
But this still does not solve the problem when people email me back... I have no idea what photo they are speaking of. Instead of a photo... there is a <photo name of some sort>.
Let me know if you ever hear on this one.
Many thanks. -
Which apps do i download when a number appears on the app button but there is no indication in the store which 2 these are ?
Click on the Updates icon in the App Store's toolbar. If there are upgrades they will be listed there.
-
Where or Having clause and COUNT(1)
I'm having trouble trying to figure out the way to get the conditional difference between two counts in a where clause.
I would like to scan a table and only select records where the record count of one column attribute is different than another.
I have
select name, count(1) from skill <<< TOTAL_COUNT
and
select name, count(1) from skill where score is not NULL <<<< SCORED_COUNT
I want to have a statement that just returns the names for those where TOTAL_COUNT - SCORED_COUNT = 0
... meaning those names where any of the rows have not been scored.
I've tried a "having clause" but it still returns all there names. Even those there TOTAL_COUNT - SCORED_COUNT > 0
Here's the non-working code....
select * from
(select full_name
from emp e
where e.manager = 'Smith, John'
having
((select count(1)
from emp_skill es
where es.emp_fk = e.id
group by null) -
(select count(1)
from emp_skill es1
where es1.emp_fk = e.id and
es1.self_prof is not NULL
group by null)) = 0
)Don't take 3360 too seriously in this context. COUNT(expression) is a bit of a running joke around these parts.
However, his response does contain the seed of the solution for your problem.
COUNT(<expression>) works because the COUNT function counts all rows with a non-null value for expression. So COUNT('Chocula') counts the non-null occurences of the literal string 'Chocula' in the table. Obviously, this counts every row in the table. COUNT(*) counts all the non-null occurences of a row in the table (even a row with all null values is a row). Clearly these are equivalent.
However, if <expression> evaluates differently for each row, then COUNT(*) and COUNT(<expression>) can differ. So, for your example, assuming that the scored column is truly NULL in some records, what you need is something like:
SQL> SELECT * FROM skill;
NAME SCORE
BOB 5
BOB 6
BOB 7
BILL 5
BILL 8
BILL
SQL> SELECT name, total, scored
2 FROM (SELECT name, count(*) total, count(score) scored
3 FROM skill
4 GROUP BY name)
5 WHERE total <> scored;
NAME TOTAL SCORED
BILL 3 2 -
Use of group by and having clause
hi frnds
can anybody explain me the use of group by an having clause in select state mentHi Rohit,
1. GROUP BY f1 ... fn
2. GROUP BY (itab)
1. GROUP BY f1 ... fn
Effect
Groups database table data in a SELECT command on one line in the result set. A group is a set of lines which all have the same values in each column determined by the field descriptors f1 ... fn.
... GROUP BY f1 ... fn always requires a list in the SELECT clause. If you use field descriptors without an aggregate funciton in the SELECT clause, you must list them in the GROUP BY f1 ... fn clause.
Example
Output the number of passengers, the total weight and the average weight of luggage for all Lufthansa flights on 28.02.1995:
TABLES SBOOK.
DATA: COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
DATA: CONNID LIKE SBOOK-CONNID.
SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
INTO (CONNID, COUNT, SUM, AVG)
FROM SBOOK
WHERE
CARRID = 'LH' AND
FLDATE = '19950228'
GROUP BY CONNID.
WRITE: / CONNID, COUNT, SUM, AVG.
ENDSELECT.
Note
... GROUP BY f1 ... fn is not supported for pooled and cluster tables.
2. GROUP BY (itab)
Effect
Works like GROUP BY f1 ... fn if the internal table itab contains the list f1 ... fn as ABAP source code. The internal table itab can only have one field. This field must be of the type C and should not be more than 72 characters long. itab must be enclosed in parentheses and there should be no blanks between the parentheses and the table name.
Note
The same restrictions apply to this variant as to GROUP BY f1 ... fn.
Example
Output all Lufthansa departure points with the number of destinations:
TABLES: SPFLI.
DATA: BEGIN OF WA.
INCLUDE STRUCTURE SPFLI.
DATA: COUNT TYPE I.
DATA: END OF WA.
DATA: WA_TAB(72) TYPE C,
GTAB LIKE TABLE OF WA_TAB,
FTAB LIKE TABLE OF WA_TAB,
COUNT TYPE I.
CLEAR: GTAB, FTAB.
WA_TAB = 'COTYFROM COUNT( * ) AS COUNT'. APPEND FTAB.
APPEND WA_TAB TO FTAB.
WA_TAB = 'CITYFROM'.
APPEND WA_TAB TO GTAB.
SELECT DISTINCT (FTAB)
INTO CORRESPONDING FIELDS OF WA
FROM SPFLI
WHERE
CARRID = 'LH'
GROUP BY (GTAB).
WRITE: / WA-CITYFROM, WA-COUNT.
ENDSELECT.
Regards,
Susmitha -
Statements to validate about BPM and WorkFlow
Hi is it possible for experts here to validate,
1. SAP Business Workflow is primarily used to develop workflow mechanisms for SAP based systems
2. Components of a Business Process Execution Language (BPEL) like the compensation handlers, exception handlers are not available out of the box in SAP Business Workflow and SAP XI BPM
Would appreciate a quick response.
CheersHi NS,
I do not know much on BPEL,
but I had read a blog by Alan.
/people/alan.rickayzen/blog/2006/12/15/bpel-in-a-nutshell
Aditya -
I've to query when I save my loadPlan for and scenario within it along with information how those scenario execute either parallel or serial.
Fetch information even before they start.
Also can Two scenario or LoadPlan have same name in single work repository.You can get the information from repository documentation on oracle support - https://support.oracle.com/epmos/faces/DocumentDisplay?id=1903225
Names must be unique for load plans, same for scenarios although they can be versioned.
Maybe you are looking for
-
I have two iphones, different telcos, i am using the same apple id for both - how can i use the 10GB icloud free memory of my new iphone 5?
-
my laptop had to be reset to factory settings. prior to that i had all my itunes songs stored on a portable drive. how do i get itunes to recognize the drive as its library?
-
The following code is part of a larger script. I'm trying to detect if the layer "Canons Grid" exists. If it doesn't then create a new layer with that name. This code fails everytime, even if the layer doesn't exist. What am i doing wrong? var doc =
-
How can I use JSF 1.2 components in NetBeans 5.5.1 with VWP
I need to use requiredMessage and converterMessage, but they are available in JSF 1.2. How can I create a Visual Web Application Project which uses JSF 1.2? Thanks
-
I have a Palm Treo 700p. Two days ago, i was trying to download Jawbreaker on my Palm and during the process, I recieved a Virus Java Pop-up window. Now I am unable to connect to my Internet Service Provider. I get error: Whenever I try to retriev