Add to Google

Sql Programming By Heaven_master_ash Own

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Others

Sql Programming By Heaven_master_ash Own

heaven_master_ash
Well This Is A Very very Easy Topic Every One Know About This thing If U Need Help To Understand Better Refer My Knowledge Gatherance Thanx..

CODE

The SQL SELECT statement queries data from tables in the database. The statement begins with the SELECT keyword. The basic SELECT statement has 3 clauses:

    * SELECT
    * FROM
    * WHERE

The SELECT clause specifies the table columns that are retrieved. The FROM clause specifies the tables accessed. The WHERE clause specifies which table rows are used. The WHERE clause is optional; if missing, all table rows are used.

For example,

      SELECT name FROM s WHERE city='Rome'

This query accesses rows from the table - s. It then filters those rows where the city column contains Rome. Finally, the query retrieves the name column from each filtered row. Using the example s table, this query produces:

      name
      Mario

A detailed description of the query actions:

    * The FROM clause accesses the s table. Contents:
            sno     name     city
            S1     Pierre     Paris
            S2     John     London
            S3     Mario     Rome
    * The WHERE clause filters the rows of the FROM table to use those whose city column contains Rome. This chooses a single row from s:
            sno     name     city
            S3     Mario     Rome
    * The SELECT clause retrieves the name column from the rows filtered by the WHERE clause:
            name
            Mario

The remainder of this subsection examines the 3 major clauses of the SELECT statement, detailing their syntax and semantics:

    * SELECT Clause -- specifies the table columns retrieved
    * FROM Clause -- specifies the tables to be accessed
    * WHERE Clause -- specifies which rows in the FROM tables to use

Extended query capabilities are covered in the next sub-section.
SELECT Clause
The SELECT clause is mandatory. It specifies a list of columns to be retrieved from the tables in the FROM clause. It has the following general format:

      SELECT [ALL|DISTINCT] select-list

select-list is a list of column names separated by commas. The ALL and DISTINCT specifiers are optional. DISTINCT specifies that duplicate rows are discarded. A duplicate row is when each corresponding select-list column has the same value. The default is ALL, which retains duplicate rows.

For example,

      SELECT descr, color FROM p

The column names in the select list can be qualified by the appropriate table name:

      SELECT p.descr, p.color FROM p

A column in the select list can be renamed by following the column name with the new name. For example:

      SELECT name supplier, city location FROM s

This produces:

      supplier     location
      Pierre     Paris
      John     London
      Mario     Rome

The select list may also contain expressions. See Expressions.

A special select list consisting of a single '*' requests all columns in all tables in the FROM clause. For example,

      SELECT * FROM sp

      sno     pno     qty
      S1     P1     NULL
      S2     P1     200
      S3     P1     1000
      S3     P2     200

The * delimiter will retrieve just the columns of a single table when qualified by the table name. For example:

      SELECT sp.* FROM sp

This produces the same result as the previous example.

An unqualified * cannot be combined with other elements in the select list; it must be stand alone. However, a qualified * can be combined with other elements. For example,

      SELECT sp.*, city
      FROM sp, s
      WHERE sp.sno=s.sno

      sno     pno     qty     city
      S1     P1     NULL     Paris
      S2     P1     200     London
      S3     P1     1000     Rome
      S3     P2     200     Rome

Note: this is an example of a query joining 2 tables. See Joining Tables.
FROM Clause
The FROM clause always follows the SELECT clause. It lists the tables accessed by the query. For example,

      SELECT * FROM s

When the From List contains multiple tables, commas separate the table names. For example,

      SELECT sp.*, city
      FROM sp, s
      WHERE sp.sno=s.sno

When the From List has multiple tables, they must be joined together. See Joining Tables.
Correlation Names
Like columns in the select list, tables in the from list can be renamed by following the table name with the new name. For example,

      SELECT supplier.name FROM s supplier

The new name is known as the correlation (or range) name for the table. Self joins require correlation names.
WHERE Clause
The WHERE clause is optional. When specified, it always follows the FROM clause. The WHERE clause filters rows from the FROM clause tables. Omitting the WHERE clause specifies that all rows are used.

Following the WHERE keyword is a logical expression, also known as a predicate.

The predicate evaluates to a SQL logical value -- true, false or unknown. The most basic predicate is a comparison:

      color = 'Red'

This predicate returns:

    * true -- if the color column contains the string value -- 'Red',
    * false -- if the color column contains another string value (not 'Red'), or
    * unknown -- if the color column contains null.

Generally, a comparison expression compares the contents of a table column to a literal, as above. A comparison expression may also compare two columns to each other. Table joins use this type of comparison. See Joining Tables.

The = (equals) comparison operator compares two values for equality. Additional comparison operators are:

    * > -- greater than
    * < -- less than
    * >= -- greater than or equal to
    * <= -- less than or equal to
    * <> -- not equal to

For example,

      SELECT * FROM sp WHERE qty >= 200

      sno     pno     qty
      S2     P1     200
      S3     P1     1000
      S3     P2     200

Note: In the sp table, the qty column for one of the rows contains null. The comparison - qty >= 200, evaluates to unknown for this row. In the final result of a query, rows with a WHERE clause evaluating to unknown (or false) are eliminated (filtered out).

Both operands of a comparison should be the same data type, however automatic conversions are performed between numeric, datetime and interval types. The CAST expression provides explicit type conversions; see Expressions.
Extended Comparisons
In addition to the basic comparisons described above, SQL supports extended comparison operators -- BETWEEN, IN, LIKE and IS NULL.

    * BETWEEN Operator

      The BETWEEN operator implements a range comparison, that is, it tests whether a value is between two other values. BETWEEN comparisons have the following format:

            value-1 [NOT] BETWEEN value-2 AND value-3

      This comparison tests if value-1 is greater than or equal to value-2 and less than or equal to value-3. It is equivalent to the following predicate:

            value-1 >= value-2 AND value-1 <= value-3

      Or, if NOT is included:

            NOT (value-1 >= value-2 AND value-1 <= value-3)

      For example,

            SELECT *
            FROM sp
            WHERE qty BETWEEN 50 and 500

            sno     pno     qty
            S2     P1     200
            S3     P2     200

    * IN Operator

      The IN operator implements comparison to a list of values, that is, it tests whether a value matches any value in a list of values. IN comparisons have the following general format:

            value-1 [NOT] IN ( value-2 [, value-3] ... )

      This comparison tests if value-1 matches value-2 or matches value-3, and so on. It is equivalent to the following logical predicate:

            value-1 = value-2 [ OR value-1 = value-3 ] ...

      or if NOT is included:

            NOT (value-1 = value-2 [ OR value-1 = value-3 ] ...)

      For example,

            SELECT name FROM s WHERE city IN ('Rome','Paris')

            name
            Pierre
            Mario

    * LIKE Operator

      The LIKE operator implements a pattern match comparison, that is, it matches a string value against a pattern string containing wild-card characters.

      The wild-card characters for LIKE are percent -- '%' and underscore -- '_'. Underscore matches any single character. Percent matches zero or more characters.

      Examples,

      Match Value     Pattern     Result
      'abc'     '_b_'     True
      'ab'     '_b_'     False
      'abc'     '%b%'     True
      'ab'     '%b%'     True
      'abc'     'a_'     False
      'ab'     'a_'     True
      'abc'     'a%_'     True
      'ab'     'a%_'     True

      LIKE comparison has the following general format:

            value-1 [NOT] LIKE value-2 [ESCAPE value-3]

      All values must be string (character). This comparison uses value-2 as a pattern to match value-1. The optional ESCAPE sub-clause specifies an escape character for the pattern, allowing the pattern to use '%' and '_' (and the escape character) for matching. The ESCAPE value must be a single character string. In the pattern, the ESCAPE character precedes any character to be escaped.

      For example, to match a string ending with '%', use:

            x LIKE '%/%' ESCAPE '/'

      A more contrived example that escapes the escape character:

            y LIKE '/%//%' ESCAPE '/'

      ... matches any string beginning with '%/'.

      The optional NOT reverses the result so that:

            z NOT LIKE 'abc%'

      is equivalent to:

            NOT z LIKE 'abc%'

    * IS NULL Operator

      A database null in a table column has a special meaning -- the value of the column is not currently known (missing), however its value may be known at a later time. A database null may represent any value in the future, but the value is not available at this time. Since two null columns may eventually be assigned different values, one null can't be compared to another in the conventional way. The following syntax is illegal in SQL:

            WHERE qty = NULL

      A special comparison operator -- IS NULL, tests a column for null. It has the following general format:

            value-1 IS [NOT] NULL

      This comparison returns true if value-1 contains a null and false otherwise. The optional NOT reverses the result:

            value-1 IS NOT NULL

      is equivalent to:

            NOT value-1 IS NULL

      For example,

            SELECT * FROM sp WHERE qty IS NULL

            sno     pno     qty
            S1     P1     NULL

Logical Operators
The logical operators are AND, OR, NOT. They take logical expressions as operands and produce a logical result (True, False, Unknown). In logical expressions, parentheses are used for grouping.

    * AND Operator

      The AND operator combines two logical operands. The operands are comparisons or logical expressions. It has the following general format:

            predicate-1 AND predicate-2

      AND returns:

          o True -- if both operands evaluate to true
          o False -- if either operand evaluates to false
          o Unknown -- otherwise (one operand is true and the other is unknown or both are unknown)

      Truth tables for AND:

      AND      T       F       U
       T       T       F       U
       F       F       F       F
       U       U       F       U
          
      Input 1     Input 2     AND Result
      True     True     True
      True     False     False
      False     False     False
      False     True     False
      Unknown     Unknown     Unknown
      Unknown     True     Unknown
      Unknown     False     False
      True     Unknown     Unknown
      False     Unknown     False

      For example,

            SELECT *
            FROM sp
            WHERE sno='S3' AND qty < 500

            sno     pno     qty
            S3     P2     200

    * OR Operator

      The OR operator combines two logical operands. The operands are comparisons or logical expressions. It has the following general format:

            predicate-1 OR predicate-2

      OR returns:

          o True -- if either operand evaluates to true
          o False -- if both operands evaluate to false
          o Unknown -- otherwise (one operand is false and the other is unknown or both are unknown)

      Truth tables for OR:

      OR      T       F       U
       T       T       T       T
       F       T       F       U
       U       T       U       U
          
      Input 1     Input 2     OR Result
      True     True     True
      True     False     True
      False     False     False
      False     True     True
      Unknown     Unknown     Unknown
      Unknown     True     True
      Unknown     False     Unknown
      True     Unknown     True
      False     Unknown     Unknown

      For example,

            SELECT *
            FROM s
            WHERE sno='S3' OR city = 'London'

            sno     name     city
            S2     John     London
            S3     Mario     Rome

      AND has a higher precedence than OR, so the following expression:

            a OR b AND c

      is equivalent to:

            a OR (b AND c)

    * NOT Operator

      The NOT operator inverts the result of a comparison expression or a logical expression. It has the following general format:

            NOT predicate-1

      Truth tables for NOT:

      NOT     
       T       F
       F       T
       U       U
          
      Input     NOT Result
      True     False
      False     True
      Unknown     Unknown

      Example query:

            SELECT *
            FROM sp
            WHERE NOT sno = 'S3'

            sno     pno     qty
            S1     P1     NULL
            S2     P1     200


Well Thats It Isnt That Very Very Easy Hope U Find It Help Ful Thanx..

 

 

 


Reply

imacul8
Now as i said on your other post for a tutorial, its not a good idea to copy paste from another persons work... or you will get busted as u have done on both of these... maybe u should stick to making tutorials for something u actually do know something about?

http://www.firstsql.com/tutor2.htm


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. programming heaven for sql - 105.26 hr back. (6)
  2. developing you own sql program - 885.32 hr back. (1)
  3. all answers to "extended prelude to programming" - 979.48 hr back. (1)
Similar Topics

Keywords : sql programming heaven ash

  1. A Prelude To Programming - What to learn? How to learn? (10)
  2. Python - another programming language (8)
    There are so many languages used in software and web development. Python is one of them. Basically
    Python is object-oriented , high-level programming language with dynamic semantics. Python was
    developed in the 90’s. Python is simple and easy to learn. Therefore it reduces cost of program
    maintenance. It is very attractive for rapid application development because of its high-level
    built-in data structures, combined with dynamic typing and dynamic binding. Python is also use as a
    scripting or glue language to connect existing components. Python supports modules and ...
  3. Programming Batch Job - (6)
    I want to know how to make a batch file that will run a program at a certain time of day, like a
    scheduled thing, but i want it in a batch.. lol.. Easy enough? If you give me permission i can edit
    it to the program i want Lol.. just put it in code tags! Thanks! Topic title must be
    specific. Modified. ...
  4. Python - Programming Language (4)
    Does anybody else know any python? I've started learning it, because I heard somewhere that it
    is quite easy to learn and I want to learn a programming language quickly /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />. I haven't learned how
    to do any complex stuff with it yet, but its still fun learning about it /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />. If you want to find out
    more info about Python, then you can go to their website. I'm not sure if i'm allowed to
    post links...
  5. Things You Should Know - things you should know about programming (0)
    This should help you know what programming languages are. C# is a language designed by Microsoft
    for the .Net framework. Its syntax is similar to C and C++, with an emphasis on being programmer
    friendly. It has memory management where C and C++ require the programmer to do this manually, it
    has array bounds checking where C and C++ don't, among many other differences. Automatic memory
    management and some other programmer-friendly features of C# sacrifice some performance, but these
    features can also make development faster and easier. This can be very attractive to ...
  6. Mac Programming Languages? - What are some good ones? (5)
    What are some good Mac Programming Languages? /huh.gif" style="vertical-align:middle" emoid=":huh:"
    border="0" alt="huh.gif" /> I have a friend from school who is like obssed with Mac and Linux (And
    thinks windows sucks when it doesn't /mad.gif" style="vertical-align:middle" emoid=":angry:"
    border="0" alt="mad.gif" /> ), and it would be cool if I could learn some Mac Programming languages
    aside from what I already know about Programming, so I could make some cool programs for mac too,
    show off, and beat him at his own game. /laugh.gif" style="vertical-align:middle...
  7. Future Of Programming... - Real Programmers Respond Please (6)
    I was watching Star Trek the other day, I think it was Voyager. Anyways I was wondering.. They refer
    to this 'trinary' code and other things like Tera Quads of information. I researched this a
    little bit and all I could find were entries about it relating to Star Trek and nothing else really.
    So I was wondering, does anyone really know or have a really good explanation of what is on the
    horizen for programming? Because I'm sure that since we created Binary and so many other ways to
    make computers work, isn't there something in the future to be made that w...
  8. Short Programming Example (in Many Languages) - (9)
    I want a thread where I can see how to solve a Varity of programming problems in many languages. The
    idea is so I can read short examples to become fluid in many languages. Both reinforcing what I know
    and learning new stuff. The problems should have a short solution and be solvable in many different
    languages. Web applications are alright but make some reference on how the code is used (e.g. CGI).
    The poster can provide the problem and as many different solutions as he likes. For example:
    Problem 1. Write a function to compute a factorial. Solution Soln. (problem 1.) ...
  9. Qbasic Tutorial By Heaven_master_ash Own - (3)
    Well this Is My Hard Work On Qbasic So Please Don Underasstimate Me I Have Learned Many Thing And
    How To Describe Them Today I tell U My Experince Of Qbasic In That Way That Every One Can Understand
    This Its Easy And nice Simple So Concentrate now.. QUOTE When you open QBasic, you see a blue
    screen where you can type your program. Let’s begin with the basic commands that are
    important in any program. PRINT Command PRINT displays text or numbers on the screen. The
    program line looks like this: PRINT “My name is Nick.” Type the bolded text ...
  10. Programming Artificial Intelligence - oh yeah... (4)
    I've been interested in the idea of working with AI later on in my career when I actually get
    the resources to do so (After college is finished). Does anyone here already know how to program
    basic AI that might be able to help get me started?...
  11. Pascal Programming - (5)
    I don't se any sub forum for pascal so I will post this here, I have some problems, how to set
    this: i need to create program for seraching and deleting some files, if you have some examples or
    source code that will be great, and how to create some skin, or I don't know to create one
    normal program not the one like the dos thanks...
  12. What Programming Languages Do You Use? - (26)
    So? What do you use? I use Turing ...
  13. Shakespeare Programming Language - (2)
    http://shakespearelang.sourceforge.net/report/shakespeare/ This is a weird language whose syntax
    is kind of like a play. It may not seem like it can do anything, but it's actually more powerful
    that it looks. The programs are much longer than those in any other language, but SPL is more fun.
    Unfortunately, there's no compiler-it has to be translated to C, then compiled from there. There
    are some example programs at the bottom....
  14. Programming From Ground Up - Best book for learning programming (1)
    This is one of the best book for learning programming with assembly language. This is a free book
    with GPL licence so this is not illegle This tutorial section states that QUOTE Contribute
    only full How-To's and Tutorials here. I feel that you did not contribute. Contribute is
    defined here as writing your own with your own words--we are looking for original tutorials. But
    thank you for the supplement. Moving from Tutorials to Computers > Programming Languages >
    Others Leaving a link behind ...
  15. What Programming Language Is Most Popular In Industry - What Programming language is most popular in industry (6)
    Hi All, I don't see any thread discuss about the pros and cons of different languages to help
    beginners, but i'm asking for a slightly different reason. I have been programming for about 1
    year now, and I know only Visual Basic. I am planning to learn some other programming langauges.
    I've learned that once you've learned one language, pretty much all you have to do is learn
    a new syntax to learn a new language. So, now I'll get to the point. I think that I should begin
    to specialize in a language. I don't know which language I should learn and ...
  16. Tried Logical Programming? - (2)
    Has anyone every looked at logical programming yet? I am interested in all sorts of programming
    paradigms. Logical programming looks kind of neat. Apparently it can be used to generate you own
    language parson. I found a fairly gentle introduction to prolog at: It gives some simple code to
    some neat problems http://www.csupomona.edu/~jrfisher/www/pro...l/contents.html You can also
    download a free compiler at: http://www.freeprogrammingresources.com/lispcompiler.html ...
  17. Newb @ Programming Seeking Suggestions - (3)
    Hey all, I'm new to programming and I have a hard time deciding on a cross-platform language
    so I can write for Linux, Macintosh, and Windows. I want to make some basic programs, and if
    possible (as in language support), games. I know that Java is one of them, so is Perl. Please
    reply. Thanks, xboxrulz...
  18. Programming Paradigms - (0)
    This discussion is created to discuss current programming paradigms and propose new programming
    paradigms. First Some thoughts: Functional programming is often used in AI languages because it
    allows a top down design approaches. The program can begin by describing the high level
    functionality and later flesh out the low level details. This is in contrast to procedural
    programming in which the problem is first broken down into smaller problems. The smaller problems
    are solved and then put together to solve the larger problem. One functional programming is called
    lisp....
  19. Palm Os Programming? - (2)
    Can anybody point me to some nice tutorials for Palm OS programming? I've got both a windows and
    a linux machine, but windows is prefered. (my linux box is currently non-functioning)...
  20. Ftp With Lots Of Programming Books - Don't wait to see (5)
    Here it is: CODE http://ftp.cdut.edu.cn/pub3/uncate_doc/ Carpe diem....
  21. TCL - Web programming with TCL (3)
    I was just wandering whether there are some old timer there using TCL to do CGI programming. It
    would be nice to hear some of the experiences you have had with it. I had to use it for something
    really specific, but now it turns out to be quite fun using it for CGI related situations....
  22. Programming E-books - and others too (0)
    Here it is: CODE http://n3t.net/TheVault/Library/ Username: ap Password: appz
    Carpe diem....



Looking for sql, programming, heaven, master, ash

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for sql, programming, heaven, master, ash

*MORE FROM TRAP17.COM*
advertisement



Sql Programming By Heaven_master_ash Own



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE