목록Backend (46)
나의 발자취

const add = (a, b) => a + b;module.exports = add; // module.export로 원하는 함수를 내보내기module.exports로 add 함수를 내보낸다. 또 다른 파일에서, 사용하고 싶은 함수가 위치한 곳을 require()를 통해 가져와 변수에 할당하고, 사용할 수 있다. const add = require('./ch03_01'); // require 함수로 함수 받기console.log(add(2, 3)); 두 개의 함수를 export하고 싶다면?ch03_01.jsconst add = (a, b) => a + b;function subtract(a, b) { return a - b;}module.exports.subtract = subtract;modul..

npm express 설치하고 제거해보기1. 경로 이동 후에 npm install express 2. cat package.json 으로 dependencies 내에 express 패키지 확인3. npm uninstall express 으로 제거4. rm -rf * 으로 완전히 모든 파일 제거 npm init 으로 초기환경 설정아래와 같이 정보를 입력해준다. yes를 누른다. express 패키지 설치하기설치 후 vi package.json을 들어가, 편집 모드를 누르고 "start": ~~ 부분을 작성해준다.

데이터베이스 설계요구 조건 분석(~명세서 작성) > 개념적 설계(개념 스키마, 트랜잭션 모델링, E-R 모델) > 논리적 설계 (목표 DBMS에 맞는 논리 스키마 설계, 트랜잭션 인터페이스 설계) > 물리적 설계(목표 DBMS에 맞는 물리적 구조의 데이터로 반환) > 구현 insert into product (product_id, product_name, unit_price, stock) values(92, '불닭볶음면', 9000, 50)on conflict (product_id)do update set product_name = excluded.product_name, unit_price = excluded.unit_price, stock = excluded.stock;product_id 키가 ..
--length()select length('hello world'); -- concat()select concat('hello', ' ','world');select 'hello' || ' ' || 'world' as "테스트"; -- left(), right()select left ('SQL Class', 5), -- SQL Cright ('SQL Class', 4), -- lasssubstring('SQL Class' from 2 for 3) -- QL; -- split_part() (String, separator, index (1부터 시작))select split_part('서울시 양천구 신정동', ' ', 2); -- 양천구 -- lpad() (String, total place, place..
select * from customer; -- as "String"select cust_id, contact_name, company_name, mileage * 1.1 as "10% 추가" from customer;select cust_id, contact_name, company_name, mileage from customer where mileage >= 100; -- order by-- limitselect cust_id, contact_name, company_name, mileage, cityfrom customerwhere city = '서울'order by mileage desclimit 3 -- distinct: 중복된 이름을 제거한 도시를 추출 select distinct city..

지난번에 열심히 꾸민 oh-my-zsh 테마가 iTerm2에서 보니 정상적으로 보여서 기본 터미널을 iTerm2로 설정하고,homebrew 설치 후 PATH를 echo 명령어로 지정해준 후 brew 명령어로 설치 확인을 한다. 정상적으로 brew 설치가 된 것이 확인되었다면, 설치 가능한 postgres를 검색한다.brew install postgresql@14 나는 @14로 했다.brew install postgresql@14 정상 설치된 모습 그다음 brew list로 확인 postgresql@14 시작 현재 존재하는 DB 조회:psql postgres 명령어를 사용해서 postgres를 시작한다.이제 접속이 완료되어 사용할 수 있게 되면, postgres=# 라는 placeh..