-
원하는 디렉토리 위치에 Repository clone
// HTTPS git clone https://github.com/Sehbeom/2021DB.git // SSH git clone git@github.com:Sehbeom/2021DB.git
-
VSCode 실행 -> week_2/hw/homework.html 실행
- 0부터 Range Bar로 설정된 숫자 사이의 숫자 랜덤으로 출력
- 입력한 숫자>=출력된 숫자 : Win, 입력한 숫자<출력된 숫자 : Lose
-
원하는 디렉토리 위치에 Repository clone
// HTTPS git clone https://github.com/Sehbeom/2021DB.git // SSH git clone git@github.com:Sehbeom/2021DB.git
-
week_3 디렉토리로 이동
cd week_3 -
express 설치 및 view 설정(hbs)
npm install -g express-generator express --view=hbs . -
npm package 설치 후 실행
npm install npm run start
-
localhost 접속
localhost:3000
-
Student Table 생성 쿼리문
create table student( -> studentID int(8) NOT NULL, -> name char(5) not null, -> grade tinyint(1) not null, -> major varchar(20) not null, -> admissionDate date not null, -> email varchar(30) not null, -> primary key(studentID));
- Database 내 Student Table의 Data 출력.
-
원하는 디렉토리 위치에 Repository clone
// HTTPS git clone https://github.com/Sehbeom/2021DB.git // SSH git clone git@github.com:Sehbeom/2021DB.git
-
week8 디렉토리로 이동
cd week8 -
npm package 설치 후 실행
npm install npm run start
-
localhost 접속
localhost:3000
-
MySQL 쿼리문
-
Employee Table
create table employee( Fname varchar(10) not null, Minit char(1) null, Lname varchar(20) not null, Ssn char(9) not null, Bdate date null, Address varchar(30) null, Sex char(1) null, Salary decimal(5,0) null, Super_ssn char(9) null, Dno int not null, primary key(Ssn) );
-
Department Table
create table department( Dname varchar(15) not null unique, Dnumber int not null, Mgr_ssn char(9) not null, Mgr_start_date date null, primary key(Dnumber) );
-
Contraints
-
FK : Employee(Dno) -> Department(Dnumber)
alter table employee add constraint Dno_Dnum foreign key(Dno) references department(Dnumber);
-
FK : Department(Mgr_ssn) -> Employee(Ssn)
alter table department add constraint Mgrssn_Ssn foreign key(Mgr_ssn) references employee(Ssn);
-
-
- Employee, Department Data 삽입
- '/update/employee' : Employee Data 수정
- 'update/department' : Department Data 수정
-
원하는 디렉토리 위치에 Repository clone
// HTTPS git clone https://github.com/Sehbeom/2021DB.git // SSH git clone git@github.com:Sehbeom/2021DB.git
-
week10 디렉토리로 이동
cd week10 -
npm package 설치 후 실행
npm install npm run start
-
localhost 접속
localhost:3000
-
MySQL 쿼리문
-
Department Table
create table department( Dname varchar(15) not null unique, Dnumber int not null, primary key(Dnumber) );
-
Subject Table
create table subject( subject_name varchar(30) not null, subject_id int not null, primary key(subject_id) );
-
User Table
create table user( Id varchar(20) not null, Password varchar(20) not null, Role varchar(5) not null, primary key(Id) );
-
- User Table의 Id, Password Data를 토대로 로그인
- Id 가 'admin' 일 경우, 삭제 가능 페이지로 연결 : '/delete'
- Id 가 'admin'이 아닐 경우, Data 출력 페이지로 연결 '/select'
- admin 계정으로 로그인 시 접속 가능
- Data 삭제 가능
- admin 계정이 아닌 계정으로 로그인 시 접속
- 단순 Data 출력 페이지