create table friends ( id integer primary key, name varchar(16) );
SELECT DISTINCT name FROM friends;
SELECT name FROM friends WHERE name ~ "k";"kei"とか"takahashi"とかがひっかかる。正規表現(perlとは違う)も使える。
SELECT tb1.col tb2.col FROM tb1 NATURAL JOIN tb2; SELECT tb1.col tb2.col FROM tb1 INNER JOIN tb2 ON tb1.id = tb2.code; SELECT tb1.col tb2.col FROM tb1 LEFT JOIN tb2 ON tb1.id = tb2.code; SELECT tb1.col tb2.col FROM tb1, tb2;