Home » SQL & PL/SQL » SQL & PL/SQL » QUERY
QUERY [message #190564] Thu, 31 August 2006 05:05 Go to next message
sam4all
Messages: 29
Registered: August 2006
Location: Bangalore
Junior Member
Hi

Is this correct query
select count(*) from t where age_group = '41 and over' and gender = 'F';

regards,
SAM
Re: QUERY [message #190567 is a reply to message #190564] Thu, 31 August 2006 05:07 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, assuming that you have the required privileges to see a table called T, and that table contains two columns of type CHAR or VARCHAR2, one called AGE_GROUP and the other called GENDER, then your query should parse and execute.

Whether it gets the right results is a question only you can answer.
Re: QUERY [message #190570 is a reply to message #190564] Thu, 31 August 2006 05:10 Go to previous messageGo to next message
gbarbisan
Messages: 67
Registered: August 2006
Location: Treviso - Italy
Member
SQL> DROP TABLE T;

Tabella eliminata.

SQL> CREATE TABLE T (AGE_GROUP VARCHAR2(50), GENDER VARCHAR2(1));

Tabella creata.

SQL> INSERT INTO T VALUES('41 and over','F');

Creata 1 riga.

SQL> commit;

Commit completato.

SQL> SELECT COUNT(*)
  2    FROM T
  3   WHERE AGE_GROUP = '41 and over'
  4     AND GENDER = 'F'
  5  /

  COUNT(*)
----------
         1

SQL> 


Be aware that SQL is case sensitive!

SQL> SELECT COUNT(*)
  2    FROM T
  3   WHERE AGE_GROUP = '41 AND OVER'
  4     AND GENDER = 'F'
  5  /

  COUNT(*)
----------
         0

SQL> 

Re: QUERY [message #190618 is a reply to message #190570] Thu, 31 August 2006 07:25 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
gbarbisan wrote on Thu, 31 August 2006 12:10

Be aware that SQL is case sensitive!
gbarbisan means that string literals are evaluated case sensitive:
'This' != 'THIS' != 'this'.

MHE
Re: QUERY [message #190619 is a reply to message #190618] Thu, 31 August 2006 07:29 Go to previous messageGo to next message
gbarbisan
Messages: 67
Registered: August 2006
Location: Treviso - Italy
Member
Maaher wrote on Thu, 31 August 2006 14:25

gbarbisan wrote on Thu, 31 August 2006 12:10

Be aware that SQL is case sensitive!
gbarbisan means that string literals are evaluated case sensitive:
'This' != 'THIS' != 'this'.

MHE




Yes, of course - I'd be a little more precise here. Sorry... Wink
Re: QUERY [message #190621 is a reply to message #190619] Thu, 31 August 2006 07:30 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
No problem, I just wanted to clarify to avoid confusion. Wink

MHE
Previous Topic: Reg : Rank Command
Next Topic: Table Funtions
Goto Forum:
  


Current Time: Tue Dec 03 21:42:17 CST 2024