TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

MYSQL dabatase. How to, tutorial, examples

Previous articlePage bottomNext article  ALL TOPICS

Mysql. select query examples: WHERE, FROM, ORDER BY DISTINCT

 
SELECT QUERY
SELECT substring(name, 1,1) as a from t_drugs_en
 
SELECT * FROM `t_testas2` LIMIT 0 , 30
 
SELECT * FROM `t_testas` LIMIT 0 , 1
 
SELECT * FROM `t_testas` LIMIT 1
 
SELECT * FROM `t_testas`
 
SELECT pinigai, vardas, vardas as v FROM `t_testas`
 
SELECT * FROM `t_testas` WHERE id = 1

>= <= > <
SELECT * FROM `t_testas` WHERE id <> 2
 
SELECT * FROM foo WHERE id > 4 ORDER BY id LIMIT 1;
 
SELECT * FROM foo WHERE id < 4 ORDER BY id DESC LIMIT 1;
 
SELECT distinct author FROM `t_songs`
 
SELECT `author`,  `cnt` as count( `id` )  FROM `t_songs`  group by `author`
 
SELECT * FROM `t_testas` WHERE vardas LIKE "jonas"
 
SELECT * FROM `t_testas` WHERE vardas = "jonas"
 
SELECT * FROM `t_testas` WHERE vardas = "jonas%"
 
SELECT * FROM `t_testas` WHERE vardas LIKE "j%"
 
SELECT * FROM `t_testas` WHERE vardas NOT LIKE "j%"
 
SELECT * FROM `t_testas` WHERE vardas LIKE "s____"
 
SELECT * FROM `t_testas` WHERE id = 1 OR id = 2
 
SELECT * FROM `t_testas` WHERE id = 1 AND id = 2
 
SELECT * FROM `t_testas` WHERE id <> 1 AND id <> 2
 
SELECT * FROM `t_testas` WHERE id <> 1 OR id <> 2
 
SELECT * FROM `t_testas` WHERE vardas NOT LIKE "j%" OR vardas NOT LIKE "s%"
 
SELECT * FROM `t_testas` WHERE vardas LIKE "j%" AND vardas LIKE "s%"
 
SELECT * FROM `t_testas` WHERE vardas LIKE "j%" AND pinigai > 4500
 
SELECT * FROM `t_testas` WHERE pinigai > 3500 AND pinigai < 4500
 
SELECT * FROM `t_testas` WHERE pinigai < 3500 AND pinigai > 4500
 
SELECT * , length( `author` ) AS `len`
FROM `t_songs`
ORDER BY len
LIMIT 5250 , 30
 
SELECT *
FROM `t_songs`
ORDER BY length( `author` )
 
SELECT *
FROM  `t_songs`
WHERE LENGTH(  `text` ) <50
 
SELECT *
FROM t_songs, t_songs AS vtable
WHERE vtable.id_r > t_songs.id_r
AND trim(vtable.name) = trim(t_songs.name) and vtable.author = t_songs.author
 
SELECT *
FROM t_songs, t_songs AS vtable
WHERE vtable.id_r > t_songs.id_r
AND trim(vtable.name) = trim(t_songs.name) and vtable.author = t_songs.author
limit 0,100
 
SELECT *
FROM t_songs, t_songs AS vtable
WHERE trim(vtable.name) = trim(t_songs.name) and vtable.author = t_songs.author and vtable.name <> t_songs.name

  
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
America is a vast conspiracy to make you happy.
John Updike
Youth is full of sport, age's breath is short; youth is nimble, age is lame; Youth is hot and bold, age is weak and cold; Youth is wild, and age is tame.
William Shakespeare
No sadder proof can be given of a person's own tiny stature, than their disbelief in great people.
Thomas Carlyle