- NOT NULL, AUTO_INCREMENT, PRIMARY KEY, DEFAULT ''
create table celeb
-> (
-> ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> NAME varchar(32) NOT NULL DEFAULT '',
-> BIRTHDAY date,
-> AGE int,
-> SEX char(1),
-> JOB_TITLE varchar(32),
-> AGENCY varchar(32)
-> );
- order by
-ASC(Ascending):오름차순으로 정렬
-DESC(Decending):내림차순으로 정렬
select 컬럼1, 컬럼2...
from 테이블이름
order by 컬럼1, 컬럼2, ... ASC|DESC;
- where - 비교연산자 조건
-ASC(Ascending):오름차순으로 정렬
-DESC(Decending):내림차순으로 정렬
select 컬럼1, 컬럼2...
from 테이블이름
where A == value
order by 컬럼1, 컬럼2, ... ASC|DESC;
- A <> value : 크거나 작은 = 같지않은
- 논리연산자 and , or , not
select* from celeb where (age<29 and sex='F') or (age>30 and sex='M');
select * from celeb where (id%2=1 and sex='M') or (id%2=0 and agency='YG') order by age;
select * from celeb where not agency = 'YG' and age<=40 order by name;