MySQL duomenų bazės (BIT)
Užklausos
SELECT * FROM country; -- Paimami visi įrašai
SELECT name, population FROM country; -- paimame visus įrašus ir stulpleius name, population
SELECT name, population FROM country WHERE name='Lithuania'; -- paimame tik įrašą kuriame name=Lithuania ir stulpelius name, population
SELECT name, population FROM country WHERE population > 200000000;
SELECT name, population FROM country WHERE population > 200000000 AND population < 500000000;
SELECT name, population FROM country WHERE population BETWEEN 200000000 AND 500000000;
SELECT name, population FROM country WHERE IndepYear IS NULL ;
SELECT c.name, c.population FROM country AS c, city WHERE IndepYear IS NULL ;
SELECT `name`, `population` FROM `country` WHERE `name` LIKE "%os%" ;
SELECT name, population FROM country WHERE population>100000000 ORDER BY population ASC; DESC - mazejanciai ASC - didejanciai
SELECT name, population, surfacearea FROM country WHERE population<10000 ORDER BY population ASC, surfacearea DESC;
SELECT name, population, surfacearea, lifeexpectancy FROM country WHERE lifeexpectancy IS NOT NULL ORDER BY lifeexpectancy ASC LIMIT 5;
SELECT name, population, surfacearea FROM country LIMIT 40,20 ;
SELECT name, population, surfacearea, lifeexpectancy FROM country WHERE name IN ("Lithuania", "Latvia") ;
SELECT name, population, surfacearea, lifeexpectancy FROM country WHERE name IN ( SELECT name FROM country WHERE IndepYear>1990 ) ;