반응형

Database/SQL 17

sql :: cmd에서 sql문서로 데이터베이스 생성하기

아래 코드 작성전 myshoppingos 라는 DB 생성후 sql를 빠져나와 명령어 프롬포트에서 아래코드 실행 C:\APM_Setup\htdocs>cd\ C:\>mysql -u root -p myshoppingos < shoppingos.sql Enter password: *** 주의)shoppingos.sql이 있는 디렉토리로 이동해야한다. 예를들어 c:\Test\ 라는 디렉토리에 shoppingos.sql파일 있다면 cd Test\ 하여 디렉토리 이동후 작업을 해야한다.

Database/SQL 2008.11.18

SQL :: 기초2

use asample select * --컬럼필터링 from sample where col004 >'서울' --인스턴스 필터링 select * from sample where col003 >= 26 and col004='서울' select * from sample where col003 >= 26 or col004='서울' --나이가 26이상 혹은 서울인 사람들은 모두 필터링 select * from sample where col002 like '%은%' --퍼센트를 어디에 붙이냐에 따라 검색 결과가 틀려진다. select * from sample where col005 is not null --값이 다 입력이 된것만 찾고 not 이 없으면 값이 없는 레코드만 출력 select * from sample ..

Database/SQL 2008.11.12

SQL :: 기초

상단에 sample 파일과 같이 첨부하였습니다. 참고하세요. DB만들기 create database A use a create table member( unum int identity(1,1) not null, --회원가입시 자동으로 순위를 맞춰준다. 괄호안의 왼쪽의 숫자는 1부터 시작하겠다는 의미고 오른쪽의 숫자는 1씩 증가하겠다는것이다. uid varchar(20) not null, --데이터가 들어가든 들어가지 않든 정하는것은 null이고 반듯이 데이터를 입력해야하는 것은 not null이다 uname varchar(20) not null, uage tinyint not null ) --db를 만들고 member란 테이블을 만들고 데이타 넣고 조회 --[1] 조회문(select문) select * ..

Database/SQL 2008.11.12
반응형