SQL문

운영자 | 기사입력 2005/03/19 [12:43]
>
필자의 다른기사 보기 인쇄하기 메일로 보내기 글자 크게 글자 작게
SQL문
 
운영자   기사입력  2005/03/19 [12:43]
입력 SQL
 insert into table_name  values('','','','');
 insert into table_name(칼럼1,칼럼2,칼럼3)values('','','');
  삭제
  delete from table_name where uid='$uid';

  수정
  update table_name sert  칼럼1='값',칼럼2='값'  where uid='$uid';
update mybbs set count=count+1 where uid='2';

  보기
  select * from table_name;
  select * from table_name order by uid DESC;
  select * from table_name order by uid ASC;
  select 칼럼1,칼럼2,칼럼3 from table_name order by uid DESC;
 
  select * from table_name order by uid DESC limit  10;
  select * from table_name order by uid DESC limit  0,10;
  select * from table_name order by uid DESC limit 10,10;
  select count(*) from table_name;
  select * from table_name where uid='$uid';
  select * from table_name where title like '$string';
  select * from table_name where uid='$uid' and name='$yname';
  select * from table_name where uid='$uid' or name='$yname';
  select * from table_name where uid='$uid' or name like '$yname';

  select distinct 칼럼 from table_name;

 select max(money) from table_name;
 select min(money) from table_name;
 select sum(money) from table_name;
 select avg(money) from table_name;
 
 select avg(money),max(money) from table_name where name='$aaa';
 
 select avg(money),max(money) from table_name where name='$aaa' group by name 
  
  
 
트위터 트위터 페이스북 페이스북 카카오톡 카카오톡
기사입력: 2005/03/19 [12:43]  최종편집: ⓒ iwav
 
 
많이 본 기사