use test;
table :데이터의 단위
널값 중복 값 허용 안됨 프라이머리 넘은 자동 증가
넘이 필드 넘이 인트 타입으로 키는 기본 키 테이블 당 하나
인크리즈는 자동 증가 1~4...
create table person (num int primary key auto_increment,
name varchar(20),age int );
필드명과 필드명 사이는 ,
ㅇㅋ 떨어지면 된거임
desc person;
기본 구조 보기
디폴
데이터 조회
select num,name,age from person;
insert into person (name,age) values('kim',12);
자료 입력하기
전체 보기*
select * from person;
콘트롤 c는 나가기 다시 들어 가기 : ;
mysql
select num,name from person;
commit ;
확실하게 인서트 저장
select * from person where name='325f';
select * from person where name like 'hj%';
%가 별과 같음
20살 이상
select * from person where name like 'jh%' and age>=20;
테이블 구조 수정
alter table person add column addr verchar(100) default '강남구'
modify 테이블 구조 수정
지울땐 drop
널 값 조회
select * from person blood=
not null 은 속성 이기 때문에 , 없음
person 세일즈의 네임
'2013-03-28' 콤마로
수량 보기 select count (*)from person;
방금 작업 취소 :
데이터 보관
setautocommit=1 복원안됨sta
0값이 롤백으로 복원됨
mlv
ifnull 에서 오라클 mvl
now() sysdate
limit ROWNUM....
select sangpum,ifnull(dan,0) from person;
select * from person limit 1,2;
select count(*) FROM PERSON;
select count(*) from sales where su>=6;
select count(*) as '5개 이상' from sales where su>=6;
select avg(dan) as '단가 평균'sum(dna) as '단가 총합',max(dan) as ' 최대값';
select sangpum,year(ipgo),month(ipgo) from person;
select sangpum,year(ipgo),month(ipgo),monthname(ipgo), dayname(ipgo) from person;
insert into person (sangpum,su,dan,ipgo) values ('초코우유',2,1900,str_to_date('20110302',%Y%m%d'));
//대소문자 구별
update person set type='dmafy where num=4;
select type,sum(su),sum(dan),count(type) from person group by type;
select type,max(su),max(dan),count(type) from person group by type;
table :데이터의 단위
널값 중복 값 허용 안됨 프라이머리 넘은 자동 증가
넘이 필드 넘이 인트 타입으로 키는 기본 키 테이블 당 하나
인크리즈는 자동 증가 1~4...
create table person (num int primary key auto_increment,
name varchar(20),age int );
필드명과 필드명 사이는 ,
ㅇㅋ 떨어지면 된거임
desc person;
기본 구조 보기
디폴
데이터 조회
select num,name,age from person;
insert into person (name,age) values('kim',12);
자료 입력하기
전체 보기*
select * from person;
콘트롤 c는 나가기 다시 들어 가기 : ;
mysql
select num,name from person;
commit ;
확실하게 인서트 저장
select * from person where name='325f';
select * from person where name like 'hj%';
%가 별과 같음
20살 이상
select * from person where name like 'jh%' and age>=20;
테이블 구조 수정
alter table person add column addr verchar(100) default '강남구'
modify 테이블 구조 수정
지울땐 drop
널 값 조회
select * from person blood=
not null 은 속성 이기 때문에 , 없음
person 세일즈의 네임
'2013-03-28' 콤마로
수량 보기 select count (*)from person;
방금 작업 취소 :
데이터 보관
setautocommit=1 복원안됨sta
0값이 롤백으로 복원됨
mlv
ifnull 에서 오라클 mvl
now() sysdate
limit ROWNUM....
select sangpum,ifnull(dan,0) from person;
select * from person limit 1,2;
select count(*) FROM PERSON;
select count(*) from sales where su>=6;
select count(*) as '5개 이상' from sales where su>=6;
select avg(dan) as '단가 평균'sum(dna) as '단가 총합',max(dan) as ' 최대값';
select sangpum,year(ipgo),month(ipgo) from person;
select sangpum,year(ipgo),month(ipgo),monthname(ipgo), dayname(ipgo) from person;
insert into person (sangpum,su,dan,ipgo) values ('초코우유',2,1900,str_to_date('20110302',%Y%m%d'));
//대소문자 구별
update person set type='dmafy where num=4;
select type,sum(su),sum(dan),count(type) from person group by type;
select type,max(su),max(dan),count(type) from person group by type;
No comments:
Post a Comment