2023 2학기 홍익대학교 데이터베이스 및 실습 과목 팀프로젝트 게시글입니다.
SQL Developer 설치
필자는 Apple 사의 MacBook air(M2) 을 사용하고 있다. 여러모로 이점도 많고 단점도 많은 arm기반 칩이다.
아래의 설치 방법은 Mac OS 기반으로 진행된다.
1. 주소를 통해 SQL Developer 를 다운받기
Mac OSX 용을 다운 받으면 된다.
OS랑 버전이 맞지 않는 것인지 모르겠지만 커널 패닉 현상이 빈번하게 일어 났다.
(추후 arm64) 버전도 테스트해보고 포스팅하겠습니다.
https://www.oracle.com/database/sqldeveloper/technologies/download/
Oracle SQL Developer Downloads
This archive. will work on a 32 or 64 bit Windows OS. The bit level of the JDK you install will determine if it runs as a 32 or 64 bit application. This download does not include the required Oracle Java JDK. You will need to install it if it's not already
www.oracle.com
2. 다운로드 경로에서 실행하여 설치하고 실행하기
다운로드 폴더에서 실행하여 설치하자
하단 Dock을 보면 아이콘이 뜰 것이다. 실행 시켜보자
3. Oracle DB 연결하기
다음을 통해 Oracle DB에 접속하면 된다.
DB Table 구축 쿼리 작성
우리는 SQLDeveloper를 설치하였고 연결까지 완료하였다.
기존 팀 프로젝트의 ERD를 참고하여 db_init.sql을 작성했다. 다음과 같다
-- 순차적으로 시퀀스 설정
CREATE SEQUENCE transaction_seq
START WITH 1
INCREMENT BY 1
NOMAXVALUE
NOCYCLE;
-- Users Table
CREATE TABLE Users (
user_id VARCHAR2(50) PRIMARY KEY,
user_name VARCHAR2(50),
user_phone VARCHAR2(50),
user_email VARCHAR2(100),
user_city VARCHAR2(100),
user_password VARCHAR2(2000),
created_date DATE
);
-- 상점 (Shops) 테이블
CREATE TABLE Shops (
shop_id NUMBER(10) PRIMARY KEY,
shop_name VARCHAR2(100),
location VARCHAR2(50) -- 시/도 단위로 대입
);
-- 물건 (Products) 테이블
CREATE TABLE Products (
product_id NUMBER(10) PRIMARY KEY,
product_name VARCHAR2(50),
unit VARCHAR2(10),
shop_id NUMBER(10) REFERENCES Shops(shop_id),
price NUMBER(7)
);
-- 거래 (Transactions) 테이블
CREATE TABLE Transactions (
transaction_id NUMBER(10) DEFAULT transaction_seq.NEXTVAL PRIMARY KEY,
user_id VARCHAR2(50) REFERENCES Users(user_id),
shop_id NUMBER(10) REFERENCES Shops(shop_id),
product_id NUMBER(10) REFERENCES Products(product_id),
purchase_date DATE,
purchase_price NUMBER(10)
);
-- 평균 물건 시세 (AverageProductPrices) 테이블
CREATE TABLE AverageProductPrices (
product_id NUMBER(10) PRIMARY KEY REFERENCES Products(product_id),
average_price NUMBER(10)
);
아래는 관련 우리 팀 프로젝트의 깃허브 주소다.
https://github.com/DataBase-501-Group2-Project-2023/OracleDB-Scripts-Config
GitHub - DataBase-501-Group2-Project-2023/OracleDB-Scripts-Config: This repository contains SQL scripts and configuration files
This repository contains SQL scripts and configuration files for setting up and configuring an Oracle Database. - GitHub - DataBase-501-Group2-Project-2023/OracleDB-Scripts-Config: This repository ...
github.com
'Computer Science (CS)' 카테고리의 다른 글
[DB] 동시성 제어(Concurrency Control), 직렬화(Serialization) (0) | 2023.11.30 |
---|---|
[DB] 트랜잭션 : 데이터 처리의 기본 작업 단위 (0) | 2023.11.30 |
[DB] Database Project - 3 오라클 데이터베이스 Entity Relationship Diagram 설계 (0) | 2023.11.28 |
[DB] Database Project - 2 주제 선정 (1) | 2023.11.28 |
[DB] Database Project - 1 (0) | 2023.11.16 |