약속(syntax)                                            
데이터베이스
 - 데이터 보관:데이터베이스관리시스템(DBMS)
 데이터 (DATA) - 숫자, 문자로 표현되는 자료
 정보(information) - 의미, 기공

  단가    수량    할인율   :  금액
  3567    5        0.13
  단가*수량*(1-할인율)   ---> 금액 
 
 주소록
 번호 이름 전화 이메일 ... 성별(man) 
   1   나나  010                1    True
        남자(1, True)/여자(0, False)

   주민번호
 18              -9
                   -0
 19  111111-1     -5         
                   -2     -6
 20  111111-3     -7
                   -4     -8
-----------------------
    use New_Pubs
go

-- query string(질의어)
-- select를 제일중요시

select * from titles  /** titles에 있는 전 불러오기 */

--제일 많이 나옴 그리고 select를 드래그하여 F5누르면 드래그한 결과만나옴

select title, price, type  -- 선택하는것 : 
 from titles
 where type = '경제' /** 어디에있는지 데이터 ''로 표시(조건) */
 order by price      /** 순서대로 어떤 순서대로 (정렬)*/
 -- 파랑색은 명령어
암기 사항

select title, price, type, pubdate
  from titles
  where type = '컴퓨터'
  order by pubdate desc  -- desc 높은 순으로 정렬
 
  -- 수필책을 출력하시오 가격높은 순으로

  select title, price, type
   from titles
   where type = '수필'
   order by price desc

  -- 컴퓨터책을 가격순으로 출력하세요

select title, price, type
   from titles
   where type = '컴퓨터'
   order by price asc -- 작은순

   select '24000'  -- 행 열 출력
   select 3+7/2 -- 계산가능
   select 3+7.0/2.0
   print '안녕하세요'  -- 결과만 출력


 select title, price, price*1.1 -- *1.1 10%를 올려라
   from titles
   order by price desc

 select title, price
   from titles
   where price = 24000 -- 데이터의 종류 type(형식)



create database New_Pubs -- 새롭게 추가한 상황 11.14
go                       -- 동일

use New_Pubs
go
-- 여기 밑에 select 4줄 글로표현
--select * from titles
--select * from publishers
--select * from sales
--select * from titleauthor









+ Recent posts