hi can anyone explain to me the diff between having and where?
set1
a b
1 2
1 NULL
1 3
2 NULL
2 1
1 NULL
select a,b from set1
where b =2
group by a,b
and
select a,b from set1
group by a,b
having b =2
both the above querries give me teh same result.
so i cant tell teh difference.WHERE applies before the grouping and aggregation, HAVING applies
afterwards the aggregation.
HTH, Jens Suessmeyer.|||You can use HAVING to apply a filter on grouped sets like
select a,b from set1
group by a,b
having COUNT(8) >2
Otherwise HAVING servers the same purpose as WHERE
Regards
Roji. P. Thomas
http://toponewithties.blogspot.com
"ichor" <ichor@.hotmail.com> wrote in message
news:uiO5W9PPGHA.3528@.TK2MSFTNGP10.phx.gbl...
> hi can anyone explain to me the diff between having and where?
> set1
> a b
> 1 2
> 1 NULL
> 1 3
> 2 NULL
> 2 1
> 1 NULL
>
> select a,b from set1
> where b =2
> group by a,b
> and
> select a,b from set1
> group by a,b
> having b =2
>
> both the above querries give me teh same result.
> so i cant tell teh difference.
>
Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts
Wednesday, March 28, 2012
having example.
Wednesday, March 21, 2012
Hash join
Can any one explain me this "Option [hash join]"...
what that Option [hash join] will effect in this query.
select * from [group] inner join patientgroup on PA_PatientID = PG_PatientID
Option [hash join]
Thanks
Noor
Noor wrote:
> Can any one explain me this "Option [hash join]"...
> what that Option [hash join] will effect in this query.
> select * from [group] inner join patientgroup on PA_PatientID =
> PG_PatientID Option [hash join]
>
> Thanks
> Noor
It will force SQL Server to use a hash join on the tables instead of a
nested loop join or a merge join. Generally, you want to let SQL Server
make up its own mind about what the best join operation is. Essentially,
a hash join forces SQL Server to create hash values on both tables in
order to determine the matching values.
To see how it affects your query test it in Query Analyzer with and
without the hint.
See Understanding Hash Joins in the BOL.
David G.
what that Option [hash join] will effect in this query.
select * from [group] inner join patientgroup on PA_PatientID = PG_PatientID
Option [hash join]
Thanks
Noor
Noor wrote:
> Can any one explain me this "Option [hash join]"...
> what that Option [hash join] will effect in this query.
> select * from [group] inner join patientgroup on PA_PatientID =
> PG_PatientID Option [hash join]
>
> Thanks
> Noor
It will force SQL Server to use a hash join on the tables instead of a
nested loop join or a merge join. Generally, you want to let SQL Server
make up its own mind about what the best join operation is. Essentially,
a hash join forces SQL Server to create hash values on both tables in
order to determine the matching values.
To see how it affects your query test it in Query Analyzer with and
without the hint.
See Understanding Hash Joins in the BOL.
David G.
Friday, February 24, 2012
handles and threads
Whats the difference between handles and threads ?
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
Thanks
A handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
Thanks
A handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
handles and threads
Whats the difference between handles and threads ?
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
ThanksA handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
ThanksA handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
handles and threads
Whats the difference between handles and threads ?
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
ThanksA handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
Also in the performance tab in Task manager , can someone explain the
meanings of each of those different values captured under totals, commit
charge, kernel memory and physical memory
ThanksA handle is a reference to something... Sometimes it may be a reference to
a file, or an object..... Perhaps you wish to open a file and the file open
gives you a handle to the file... ( a reference to it) which you store in a
variable, and use the variable to reference the file for reading/writing.
etc.
A thread is an individually schedulable piece of work... A program( or
process) always has at least one thread. A program ( like SQL) may fire off
many threads, which work co-operatively or independently. This is called
multi-threading... When a program has multiple users ( like SQL),
multi-threading allows mulitple users to get work done at the same time...
A similar example might be a single lane road going up a mountain, with an
18 wheeler at the front of the line... No one can make more progress than
the 18 wheeler... If there were multiple lanes on the road ( equivalent to
multiple threads in an application), the others would not be blocked or
slowed down by the 18 wheeler...
Although someone else might do a better job on the task manager part... I'll
give it a stab..
Physical memory is the actual physical memory on the computer... Windows
however can act as if there were more memory available than what is
physically on the box (virtual memory). How much virtual memory is used ( I
beleive) is commit charge... Kernel memory is how much memory the OS is
using.
If you run Task Manager, select help, and on the search tab type "commit
charge". You will be taken to a window that has a short description of the
meanings as well.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:ekX1i35cEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Whats the difference between handles and threads ?
> Also in the performance tab in Task manager , can someone explain the
> meanings of each of those different values captured under totals, commit
> charge, kernel memory and physical memory
> Thanks
>
Subscribe to:
Posts (Atom)