What does where 1=1 mean in sql code

I am going throough someones sql code and they have used where 1=1 in alot of places what is this for... it doesnt make sense to me...

"create table emp1 as select * from emp where 1=1"
While your statement that this will create a copy of the emp table is true, the predicate is meaningless.
CREATE TABLE emp1 AS
SELECT * FROM empwill do the exact same thing with less typing.
Puppethead
The same argument applies to your use of the predicate in development. WHERE 1 = 1 does not change the meaning of the query, no matter how many other predicates you add or remove from the query. The result of the query will be governed by the meaningful predicates in the WHERE clause.
WHERE 1 = 1 is noise, and is ignored by the optimizer.
SQL> EXPLAIN PLAN SET statement_id = 'john' for
  2  SELECT COUNT(*) FROM demographic
  3  WHERE patient_first_name = 'JOHN';
Explained.
SQL> SELECT plan_table_output
  2  FROM TABLE(dbms_xplan.display('plan_table','john','serial'));
PLAN_TABLE_OUTPUT
| Id  | Operation            |  Name        | Rows  | Bytes | Cost  |
|   0 | SELECT STATEMENT     |              |     1 |    17 |  1969 |
|   1 |  SORT AGGREGATE      |              |     1 |    17 |       |
|*  2 |   TABLE ACCESS FULL  | DEMOGRAPHIC  |  1547 | 26299 |  1969 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
   2 - filter("DEMOGRAPHIC"."PATIENT_FIRST_NAME"='JOHN')
Note: cpu costing is offNote that explain plan reports that it used the predicate as a filter during the full scan. Now, 1 = 1:
SQL> EXPLAIN PLAN SET statement_id = 'johna' for
  2  SELECT COUNT(*) FROM demographic
  3  WHERE 1 = 1;
Explained.
SQL> SELECT plan_table_output
  2  FROM TABLE(dbms_xplan.display('plan_table','johna','serial'));
PLAN_TABLE_OUTPUT
| Id  | Operation             |  Name          | Rows  | Bytes | Cost  |
|   0 | SELECT STATEMENT      |                |     1 |       |   119 |
|   1 |  SORT AGGREGATE       |                |     1 |       |       |
|   2 |   INDEX FAST FULL SCAN| DEMOGRAPHIC_4  |   154K|       |   119 |
Note: cpu costing is offNote that there is no predicate used. Even combining both, I still get only one predicate evaluated:
SQL> EXPLAIN PLAN SET statement_id = 'johnb' for
  2  SELECT COUNT(*) FROM demographic
  3  WHERE patient_first_name = 'JOHN' and
  4        1 = 1;
Explained.
SQL> SELECT plan_table_output
  2  FROM TABLE(dbms_xplan.display('plan_table','johnb','serial'));
PLAN_TABLE_OUTPUT
| Id  | Operation            |  Name        | Rows  | Bytes | Cost  |
|   0 | SELECT STATEMENT     |              |     1 |    17 |  1969 |
|   1 |  SORT AGGREGATE      |              |     1 |    17 |       |
|*  2 |   TABLE ACCESS FULL  | DEMOGRAPHIC  |  1547 | 26299 |  1969 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
   2 - filter("DEMOGRAPHIC"."PATIENT_FIRST_NAME"='JOHN')
Note: cpu costing is offJohn

Similar Messages

  • What does _total for instance mean in SQL server log space used alert

    Hi,
    I would like to know the meaning of specifying _total for instance when creating log space used alert in SQL server 2008R2 server.
    Thanks,
    Preetha

    Hi,
    ‘_total’ means performance condition alerts are available for all the database and it monitors all the existing databases.
    Check out the following TechNet article for more information about
    performance condition:
    http://technet.microsoft.com/en-us/library/ms180982.aspx
    Thanks.
    Tracy Cai
    TechNet Community Support

  • What does 'security setup forms that accept sql statement' mean?

    I was referring one white paper 'Best Practices for Securing Oracle E-Business Suite'.
    I would like to know what does 'security setup forms that accept sql statement' mean in that?
    My question is
    Where can the SQL statements be entered?
    It would be better if I can have some examples of the same. I am trying to understand this statement.
    Edited by: Kavipriya on 30 Mar, 2011 3:37 PM

    It is explained in the same docs.
    Best Practices for Securing the E-Business Suite [ID 189367.1] -- Page 26, under "LIMIT ACCESS TO FORMS ALLOWING SQL ENTRY" section.
    Best Practices For Securing Oracle E-Business Suite Release 12 [ID 403537.1] -- Page 22, under "LIMIT ACCESS TO FORMS ALLOWING SQL ENTRY" section.
    Thanks,
    Hussein

  • I was playing with my ipad settings (it's an older model) and noted in the advanced settings of Safari there was a place to view website databases.  When I clicked on this I saw websites.  How do these get there and what does the space amount mean?

    I was playing with my ipad settings and noted in he advanced settings of Safari there was a place to view "website databases".  When I selected this I saw a multitude of websites.
    Can anyone tell me how these get there?  Can a website be posted even if it was never went to?  What does the space amount mean?  For example, 1.5 kb...is this quite a bit?  Would it indicate someone has gone to a site multiple times?
    I share my ipad with my teenage daughter and I'm trying to find out if she's lying to me.  Obviously she's swearing that she has "no idea" how these got there and I'm trying to keep her safe (she's only 14).
    Thanks everyone.
    Concerned Mom

    Think of your PC and the 'temporary internet folder' where it keeps cached copies of web pages or elements off a web page for 'quicker display the next time you visit'. That's pretty much what that folder is. 1.5K is tiny. Probably just a basic page with some text on it. (you might be confusing 1.5K with 1.5 megabyte....megabyte is large...it's roughly 1000 kilobytes, so the 1.5K is a tiny file)
    As far as I know, the only way info gets into that folder is if the browser has been to that site.
    if you have a concern there are browsers out there, McGruff is one i've seen recommended, that allow some degree of parental control and supervision. That or you could passcode lock the iPad or enable the restrictions to turn off some parts of the device to have some control.

  • What does this message icon mean on a blackberry​?

    What does this message icon mean on a blackberry? so when i send a text message it normally place a check mark with a small D above it. But i just got one with just a check mark, with no D above it. and i was wondering what it meant? oh and i have the blackberry tour, but it may be the same on all blackberry phones.

    check means sent over network
    D means delivered.
    R means read.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • What does the apple sign mean when sometimes it shows ?

    What does the apple logo mean when sometimes i turn it on it just pops up and goes back to normal??

    Ayip,
    The Apple logo appearing on your iPod nano is your nano's start-up icon. Normally, when you turn off your iPod nano, you are really putting it into a deep or semi-deep sleep, where it is ready to turn on at the push of a button and resume where you left off in your Now Playing list.
    If, however, you leave your iPod in a sleep mode for some time , it will shut down. To turn it on again, you'll need to hit the center button (deep and semi-deep will wake up with any button press). When turning the iPod on from a shut down state, it will display the Apple logo while loading your music iPod software.
    Hope this helps!
    Sincerely,
    -FD

  • What does -sh-3.2 mean? and why cant I get into :/ root

    HELP what does -sh-3.2 mean and how do I get back to the root dir ???

    sh-3.2$  is a /bin/sh bourne shell prompt.
    So are you talking about a Terminal session, or are you in single user mode?
    What account are you logged in as?
    What do you expect to see?  Something like:  computername:~ username$
    I think you have a command prompt, so getting to the root directory would be as simple as
        cd /
    and
        pwd
    will tell you what directory you are currently in.
    But Frank Caggiano is correct, you really do need to give a better description of what you are seeing, where you are seeing it, what you expect, and what it is you are trying to actually do.

  • HT204323 what does the padlock icon mean

    What does the padlock symbol mean when i try to start my macbook

    It means the open firmware password is set.  Please use this tip to find out where to post in the future:
    http://discussions.apple.com/docs/DOC-2463

  • I got an iphone from Hong Kong which is locked one. Can anyone explain me what does a locked iphone means. How do I use it in India now, with my own sim card. How do I unlock it???

    I got an iphone from Hong Kong which is locked one. Can anyone explain me what does a locked iphone means. How do I use it in India now, with my own sim card. How do I unlock it???

    If your iPhone is locked to a wireless provider, only that wireless provider
    can unlock it. Contact the wireless provider in Hong Kong to see if they
    offer unlocking and if you qualify.
    If your iPhone is locked to an AppleID that you do not know, return it for
    a refund as it is useless. Only the person whose AppleID was used for
    activation can remove the lock. There is no workaround for Activation Lock.
    If neither of the above is what you are facing, provide more detail so someone
    may offer a solution.

  • I have many photos that are visible as thumbnails in the Pictures Library, however when I try to open them in a big screen they show a back screen with an exclamation mark in a triangle.  What does this exclamation mark mean ?

    I can see my images in the libarary as thumbnails but when i try to edit/email some of them become Exclamation Marks in a triangle.
    What does the exclamation mark mean and how to i retrieve the photo

    The exclamation make is an indication that iPhoto has broken the file path to the original photo.
    Make a temporary, backup copy (if you don't already have a backup copy) of the library and apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • What does "extracted channel PDF" mean and why does it continually duplicate on my desktop?  I think it happens when I move a file in Finder to another file and when I copy some web files.  How do I avoid this on my Mac (Mavericks)?  Thanks for your help!

    What does "extracted channel PDF" mean and why does it continually duplicate on my desktop?  I think it happens when I move a file in Finder to another file and when I copy some web files.  I have to immediately move to trash all the duplications on my desktop.  How do I avoid this on my Mac (Mavericks)?  Thanks for your help!

    What application is set to open PDF files? If you CNTRL click on the file and open with Preview does the problem occur?
    If not change the default application to open PDF files to Preview.
    You can do this by highlighting the file and either use CMD i or Get Info , this will open a window with the info on the file with an option to change the application that opens the file.
    That's all I can think of.

  • I understand that when using Numbers/Pages - an up-arrow on a document means that the file is still to be uploaded to the cloud, what does a down arrow mean? It seems the document can't be accessed until the arrow clears.

    I understand that when using Numbers/Pages - an up-arrow on a document means that the file is still to be uploaded to the cloud, what does a down arrow mean? It seems the document can't be accessed until the arrow clears.

    I believe what it's supposed to mean is that some changes were made to the document on another device, and those changes were saved back to the cloud.  Now you've opened iWork on a different device to access that document - it compares the document you've got locally with the one in the could, sees some recent changes and downloads them.
    What gets me is why this sometimes happens even when I've not made any changes to a document from another device.

  • What does "on my mac' mean and how do i delete or reduce the number of items in there?

    What does "on my mac" mean and how do i delete or reduce the number?

    Hi ya
    I'm seeing this on my email screen, on the left hand side - under the "RSS Apple".  The number of items in there is now 752.  It's preventing me from sending and receiving emails in my AOL account.
    Any  help would be deeply appreciated.
    Thank you.

  • What does "update carrier settings" Mean?  Settings for what?

    What does "update carrier settings" Mean?  Settings for what?

    It means just what it says. Carrier settings are the settings the carrier installs on the phone to connect it properly to their network. Periodically, carriers push updates to those settings. You should accept them.

  • HT1766 what does restor back up means/what does it do

    what does restor back up mean?/what does it do

    it stores all the data on your device in another place so that you can restore from it if a problem happens (say your device crashes or gets erased). then all your data is restored to your iPhone/iPod/iPad/Mac.

Maybe you are looking for

  • S-Video Output

    I have a PowerBook G3 Wallstreet Edition running Mac OS 10.2.8. It has an S-Video port on the back. I can not figure out how to make anything come out of it though, and when I plug it in to my TV it does not get the signal. Does OS X support the S-Vi

  • Volume differences between songs

    Okay. My mp3 files in iTUNES play fine. I have the Sound Check checked and they play at the same volume. The problem I have is when I load the songs to my iPOD, the volumes are not the same. Some songs are softer than others. And just using the volum

  • IE6 bookmarks aren't being imported when using the import function in Firefox.

    I tried using the import function but it didn't work.

  • [svn:fx-4.x] 15172: integrate latest 10.1 players 10_1_d50_507

    Revision: 15172 Revision: 15172 Author:   [email protected] Date:     2010-03-31 10:32:40 -0700 (Wed, 31 Mar 2010) Log Message: integrate latest 10.1 players 10_1_d50_507 QE notes: no Doc notes: no Bugs: sdk-25787 Reviewer: no Tests run: ct Is notewo

  • How to transfer music and photos to a new pc from ipad

    hi everyone, i just got a new laptop from my office.my itunes libraray was earlier in personal laptop,but i want to have it in offcial too. i transfred apps to new itunes on new lappy via my iphone & ipad by transfer purchases. but its music and phot