짜리몽땅 매거진

CREATE, INSERT INTO VALUES, SELECT FROM (2) 본문

Data/SQL

CREATE, INSERT INTO VALUES, SELECT FROM (2)

쿡국 2023. 8. 10. 17:07
USE pokemon;

SELECT * FROM mypokemon;

SELECT type FROM mypokemon 
WHERE name='eevee'; 

SELECT attack, defense FROM mypokemon
WHERE name='caterpie';

SELECT * FROM mypokemon
WHERE weight>6 ;

SELECT name FROM mypokemon
WHERE height>0.5 AND weight>6 ;

SELECT name AS weak_pokemon FROM mypokemon
WHERE attack<50 OR defense<50 ;

SELECT * FROM mypokemon
WHERE NOT(type='normal') ;

SELECT name, type FROM mypokemon
WHERE type IN('normal','fire','water','grass') ;

SELECT name, attack FROM mypokemon
WHERE attack BETWEEN 40 and 60 ;

SELECT name FROM mypokemon
WHERE name LIKE '%e%' ;

SELECT * FROM mypokemon
WHERE name LIKE '%i%' AND speed<=50;

SELECT name, height, weight FROM mypokemon
WHERE name LIKE '%chu' ;

SELECT name, defense FROM mypokemon
WHERE name LIKE '%e' AND defense<50 ;

SELECT name, attack, defense FROM mypokemon
WHERE attack-defense>=10 or defense-attack>=10 ;

SELECT name, attack+defense+speed AS total FROM mypokemon
WHERE attack+defense+speed>=150 ;