설치 (Linux)
1. URL : https://www.sqlite.org/download.html
SQLite Download Page
Templates (1) and (2) are used for source-code products. Template (1) is used for generic source-code products and templates (2) is used for source-code products that are generally only useful on unix-like platforms. Template (3) is used for precompiled bi
www.sqlite.org
2. 명령어를 통한 설치 (명령어로 설치시 서비스 등록 등 자동으로 설정)
sudo apt install sqlite3
사용법
database 생성 및 table 생성
// 명령어를 입력한 경로에 파일 생성
sqlite3 [database name]
// 버전 확인
select sqlite_version();
// 데이터 베이스 목록 조회
pragma database_list;
// table 목록 조회
.tables;
// query 이용
SELECT * FROM sqlite_master WHERE type='table';
// 테이블 생성
// type 종류 null, integer, real(실수), text(utf8..), blob(binary large object)
// https://www.tutorialspoint.com/sqlite/sqlite_data_types.htm
create table [table name] ([field] [type] primary key, [field] [type]....)
contstraint(제약 조건) 생성
sqlite는 alter에서 제약 조건을 생성할 수 없음 (table 이름 변경, column 이름 변경, column 추가)
// 예시
create table auth(
role text primary key not null
)
create table user(
id text primary key not null,
pw text not null,
name text not null,
email text not null,
role text not null references auth(role) on update cascade on delete set null,
createAt text,
updateAt text
)
DB Browser for SQLite 설치 (Ubuntu20.04)
Downloads - DB Browser for SQLite
(Please consider sponsoring us on Patreon 😄) Windows Our latest release (3.12.2) for Windows: Windows PortableApp Note - If for any reason the standard Windows release does not work (e.g. gives an error), try a nightly build (below). Nightly builds ofte
sqlitebrowser.org
// apt 저장소 추가
sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser
sudo apt-get update
sudo apt-get install sqlitebrowser
// 실행
sqlitebrowser
'DB' 카테고리의 다른 글
MongoDB + Compass 설치 (Docker Container + M2 Silicon) (0) | 2023.07.12 |
---|---|
InfluxDB 설치, 사용법 및 개념(Docker Container) (1) | 2023.04.10 |
InfulxDB, Grafana 설치 및 연동 (Ubuntu20.04) (0) | 2023.03.20 |