PHP Classes
Icontem

File: samples/test.txt


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  SQL Parse and Compile  >  samples/test.txt  
File: samples/test.txt
Role: Auxiliary script
Content type: text/plain
Description: Author's testing statements
Class: SQL Parse and Compile
Parse and compose SQL queries programatically
 

Contents

Class file image Download
// tested with following sql statements

SELECT article, dealer, price
FROM   shop s1
WHERE  price=(SELECT MAX(s2.price)
              FROM shop s2
              WHERE s1.article = s2.article);


SELECT article, MAX(price) AS price
FROM   shop
GROUP BY article


SELECT article, dealer, price
FROM shop
ORDER BY price DESC
LIMIT 1


SELECT MAX(article) AS article FROM shop


SELECT * FROM shop


SELECT s1.article, s1.dealer, s1.price
FROM shop s1
LEFT JOIN shop s2 ON s1.article = s2.article AND s1.price < s2.price
WHERE s2.article IS NULL;


SELECT s.* FROM person p INNER JOIN shirt s
   ON s.owner = p.id
 WHERE p.name LIKE "Lilliana%"
   AND s.color <> "white"
  

SELECT field1_index, field2_index FROM test_table
WHERE field1_index = '1' OR  field2_index = '1'


SELECT field1_index, field2_index
    FROM test_table WHERE field1_index = '1'
UNION
SELECT field1_index, field2_index
    FROM test_table WHERE field2_index = '1';


SELECT d_year,d_month,BIT_COUNT(BIT_OR(1<<day)) AS days FROM t1 GROUP BY d_year,d_month;

INSERT INTO person VALUES (NULL, "Antonio Paz")

UPDATE person SET lastname = "Antonio Paz" WHERE id=2

DELETE FROM person WHERE id=2


 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products