[태그:] SQLite

  • How to Open and Manage SQLite Files on Windows 11

    SQLite files are a way of storing data in a single file without a separate database server. The file extension is usually .db, .sqlite, .sqlite3 In the form. Even in Windows 11, you can open SQLite files, check the table structure, query data, and modify it with SQL queries if you have the right tools installed.

    For beginners, the easiest choice is DB Browser for SQLiteIf you need to check with the development environment VS Code extension programis convenient, and if you need repetitive tasks or automation SQLite command-line toolis useful.

    What is an SQLite file?

    SQLite is a lightweight database that can be used without running a separate server. Unlike MySQL or PostgreSQL, which connect to a server, the entire database is contained in a single file.

    For example, the following file can be an SQLite database.

    data.db
    database.sqlite
    app.sqlite3
    backup.db

    SQLite is often used in mobile apps, desktop programs, browser local data, test databases, and small web applications. The advantage is that you can open and view the contents with just one file, but if you modify the original file incorrectly, it can affect the entire data.

    Three Ways to Open SQLite Files in Windows 11

    There are three main ways to check SQLite files in Windows 11.

    MethodRecommended forAdvantages
    DB Browser for SQLiteBeginners, general usersEasily view tables and data on the screen
    SQLite CLIDevelopers, automation usersQuickly query with commands and enable scripting
    VS Code extensionDevelopers in progressDB verification possible within code editor

    If you just need to check the file contents and modify some data, it’s better to use DB Browser for SQLite first.

    Method 1. Open with DB Browser for SQLite

    DB Browser for SQLite is a free tool that allows you to open and manage SQLite files in a graphical interface. You can view table data like in Excel and execute SQL queries directly.

    Installation

    1. Access the official DB Browser for SQLite website.
    2. Download the installation file for Windows.
    3. Run the installation file.
    4. After installation, run DB Browser for SQLite from the start menu.

    The official download page is organized at the bottom of this article in the references.

    Open an SQLite file

    After running the program, proceed in the following order:

    1. Top Open DatabaseClick
    2. Open .db, .sqlite, .sqlite3 Select a file
    3. When the file is opened, the database structure is displayed on the screen

    The screen usually displays the following tabs

    TabsFunction
    Database StructureCheck table, column, and index structure
    Browse DataInquire and modify table data
    Edit PragmasCheck SQLite settings
    Execute SQLExecute SQL queries

    Check table structure

    If you have opened the file, first check the tabs. Database Structure This is where you can see what tables are in the database.

    For example, there may be tables like the following.

    users
    orders
    products
    settings
    logs

    By selecting each table, you can check the column name, data type, and whether it is a primary key.

    Column NameTypeMeaning
    idINTEGERUnique Number
    nameTEXTName
    emailTEXTEmail
    created_atTEXTCreation Date

    If it’s your first time seeing an SQLite file, it’s safe to check the table structure before modifying the data.

    Viewing and Editing Data

    If you want to view the data directly Browse Data Use the tabs.

    1. Click the Browse Data tab.
    2. Select the desired table from the table selection list at the top.
    3. The data is displayed in a table format.

    Clicking a cell allows you to modify its value. After modification, you must click the Write Changes button at the top to save it to the actual file. On the other hand, to cancel without saving, use the Revert Changesbutton.

    If it’s an important file, it’s recommended to make a copy and test it instead of modifying the original directly.

    Executing SQL Queries

    DB Browser for SQLite’s Execute SQL You can execute SQL queries directly in the tab.

    To check all the data, enter the following:

    SELECT * FROM users;

    If you want to see only the last 10 data, run the following:

    SELECT *
    FROM users
    ORDER BY id DESC
    LIMIT 10;

    You can also find only the data that matches specific conditions.

    SELECT *
    FROM users
    WHERE email LIKE '%gmail.com';

    Before executing a delete or modify query, you must first check the target data with SELECT.

    SELECT *
    FROM users
    WHERE id = 10;

    After checking, execute UPDATE only when necessary.

    UPDATE users
    SET name = '김철수'
    WHERE id = 10;

    UPDATE or DELETE without conditions can affect all data, so be especially careful.

    Frequently used SQLite commands

    When checking SQLite files, the following queries are often used:

    Check the list of all tables

    SELECT name
    FROM sqlite_master
    WHERE type = 'table';

    Check the columns of a specific table

    PRAGMA table_info(users);

    Check the number of data

    SELECT COUNT(*)
    FROM users;

    Check for duplicate values

    SELECT DISTINCT category
    FROM products;

    Search for specific strings

    SELECT *
    FROM users
    WHERE name LIKE '%홍길동%';

    Method 2. Using the SQLite command-line tool

    If you’re a developer, you can use sqlite3.exethe official SQLite command-line tool.

    After downloading the tool for Windows from the official SQLite download page and unzipping it, you can use sqlite3.exe the file.

    Run it in PowerShell or the command prompt as follows:

    sqlite3 database.db

    Once the SQLite prompt opens, you can use the following commands.

    .tables

    If you want to see the table structure, run the following command.

    .schema users

    To view some data, enter the following:

    SELECT * FROM users LIMIT 10;

    To finish the task, terminate with the following command:

    .quit

    The command-line tool is beneficial for repetitive tasks, backup checks, and simple automation. However, for first-time users, GUI tools are more intuitive.

    Method 3. Open SQLite file in VS Code

    If you are already using Visual Studio Code, you can install the SQLite extension to open the file.

    The order of use is as follows:

    1. Run VS Code.
    2. Open the Extensions menu.
    3. SQLite Or SQLite ViewerSearch for
    4. Install the extension.
    5. .db Or .sqlite Open the file to check the table.

    It is useful when you need to quickly check the database contents within a project under development. Another advantage is that you can view SQL files, code, and databases together on one screen.

    If you are not familiar with VS Code, it is a good idea to learn the basic installation and terminal usage first. For more information, you can also refer to Thinknote’s Reasons why Vib coding beginners get stuck, IT map that you should know before codingYou can also refer to this.

    Exporting and importing as CSV

    In DB Browser for SQLite, you can export table data as a CSV file.

    1. Select a table in the Browse Data tab.
    2. Click File in the top menu.
    3. Select Export.
    4. Select Table(s) as CSV file.
    5. Specify the save location.

    You can check the data in Excel or Google Sheets by exporting it as a CSV file.

    Conversely, you can also import a CSV file into an SQLite table.

    1. Open the File menu.
    2. Select Import.
    3. Select Table from CSV file.
    4. Select the CSV file.
    5. Check the delimiter and encoding.
    6. Run the import.

    If the Korean text is broken, you need to check the encoding again based on UTF-8 or CP949.

    Things to check when an SQLite file cannot be opened

    If the SQLite file cannot be opened, check the following items.

    Do not judge based on the extension alone.

    .db Not all files with extensions are SQLite files. Some programs use extensions for their own data formats as well. .db If it doesn’t open in DB Browser for SQLite, it may not be in SQLite format.

    Close the program being used

    If a program is using the file, it may be locked and cannot be modified. In this case, close the program or create a copy of the file and try opening the copy.

    Check integrity

    If you suspect file damage, you can run the following command in the SQLite CLI.

    PRAGMA integrity_check;

    If the result is okthen the basic integrity check has passed.

    Always back up before modifying

    SQLite stores the entire database in a single file, so backing up before modifying is crucial.

    For example, you can copy the original like this.

    database.db
    database_backup.db

    In particular, backup is essential in the following situations.

    • When modifying the database of a program in operation
    • When customer data or business data is included
    • When executing DELETE, UPDATE, DROP TABLE commands
    • When changing the table structure
    • When importing bulk data with CSV import

    Directly editing an SQLite file may seem simple, but if you make a mistake, it can be difficult to recover. It’s a good habit to always test modifications in a copy first.

    What tools should I choose?

    The recommended tools vary slightly depending on the purpose.

    PurposeRecommended tool
    Quickly check the file contentsDB Browser for SQLite
    Directly edit dataDB Browser for SQLite
    Checking DB during developmentVS Code SQLite extension
    Command-based inspectionSQLite CLI
    Automating repetitive tasksSQLite CLI or Python
    Excel integrationExporting and importing CSV

    If it’s your first time, it’s best to start with DB Browser for SQLite and then use SQLite CLI and VS Code extensions together once you get used to it.

    Conclusion

    Opening an SQLite file in Windows 11 is not difficult. The easiest way is to install DB Browser for SQLite and .db, .sqlite, .sqlite3 open the file.

    Once the file is opened, you can check the table structure, query data, and search or modify it using SQL queries if necessary. However, since all data is stored in a single SQLite file, it’s essential to back it up before making any modifications.

    To summarize, the following applies.

    • For beginners, DB Browser for SQLite is the easiest to use.
    • Developers can use VS Code extensions or SQLite CLI together for convenience.
    • Before modifying data, you must back up the original file.
    • Delete and modify queries must be executed after verifying the target with SELECT first.
    • Using CSV export and import makes it easy to work with Excel.

    SQLite is a lightweight but very practical database. With the right tools, you can safely open and manage SQLite files even on Windows 11.

    FAQ

    Do I need to install an SQLite server to open an SQLite file?

    No, SQLite is not server-based. You only need a program or command-line tool that can open SQLite files.

    .db Are all files SQLite files?

    No. .db Even if a file has an extension, it may be a proprietary format file that is not SQLite. If it does not open in DB Browser for SQLite, you need to check the file format again.

    Are changes to SQLite files saved immediately?

    In DB Browser for SQLite, you need to click Write Changes after modifying values to save them to the actual file. Before saving, you can revert changes using Revert Changes.

    Can SQLite files be opened directly in Excel?

    It’s not common to open SQLite files directly in Excel. The easiest way is to export them as CSV from DB Browser for SQLite and then open them in Excel.

    What is the most recommended SQLite tool for Windows 11?

    For first-time users, DB Browser for SQLite is recommended. For developers, using SQLite CLI and VS Code extension together is a good option.

    Reference materials

    Original Korean article: https://www.thinknote.co.kr/windows-11-sqlite-file-open-manage/

  • Windows 11에서 SQLite 파일을 열고 관리하는 방법

    SQLite 파일은 별도의 데이터베이스 서버 없이 하나의 파일 안에 데이터가 저장되는 방식입니다. 파일 확장자는 보통 .db, .sqlite, .sqlite3 형태로 되어 있습니다. Windows 11에서도 적절한 도구만 설치하면 SQLite 파일을 열어 테이블 구조를 확인하고, 데이터를 조회하고, 필요한 경우 SQL 쿼리로 수정할 수 있습니다.

    처음 다루는 사용자라면 가장 쉬운 선택은 DB Browser for SQLite입니다. 개발 환경에서 함께 확인해야 한다면 VS Code 확장 프로그램이 편하고, 반복 작업이나 자동화가 필요하다면 SQLite 명령줄 도구가 유용합니다.

    SQLite 파일이란?

    SQLite는 서버를 따로 실행하지 않아도 사용할 수 있는 경량 데이터베이스입니다. MySQL이나 PostgreSQL처럼 서버에 접속하는 방식이 아니라, 데이터베이스 전체가 하나의 파일에 들어 있습니다.

    예를 들어 다음과 같은 파일이 SQLite 데이터베이스일 수 있습니다.

    data.db
    database.sqlite
    app.sqlite3
    backup.db

    SQLite는 모바일 앱, 데스크톱 프로그램, 브라우저 로컬 데이터, 테스트용 데이터베이스, 소규모 웹 애플리케이션에서 자주 사용됩니다. 파일 하나만 있으면 내용을 열어볼 수 있다는 장점이 있지만, 그만큼 원본 파일을 잘못 수정하면 전체 데이터에 영향을 줄 수 있습니다.

    Windows 11에서 SQLite 파일을 여는 세 가지 방법

    Windows 11에서 SQLite 파일을 확인하는 방법은 크게 세 가지입니다.

    방법추천 대상장점
    DB Browser for SQLite초보자, 일반 사용자화면에서 테이블과 데이터를 쉽게 확인
    SQLite CLI개발자, 자동화 사용자명령어로 빠르게 조회하고 스크립트화 가능
    VS Code 확장 프로그램개발 중인 사용자코드 편집기 안에서 DB 확인 가능

    단순히 파일 내용을 확인하고 일부 데이터를 수정하는 목적이라면 DB Browser for SQLite를 먼저 사용하는 것이 좋습니다.

    방법 1. DB Browser for SQLite로 열기

    DB Browser for SQLite는 SQLite 파일을 그래픽 화면에서 열고 관리할 수 있는 무료 도구입니다. 엑셀처럼 테이블 데이터를 볼 수 있고, SQL 쿼리도 직접 실행할 수 있습니다.

    설치하기

    1. DB Browser for SQLite 공식 사이트에 접속합니다.
    2. Windows용 설치 파일을 다운로드합니다.
    3. 설치 파일을 실행합니다.
    4. 설치가 끝나면 시작 메뉴에서 DB Browser for SQLite를 실행합니다.

    공식 다운로드 페이지는 글 하단의 참고자료에 정리해 두었습니다.

    SQLite 파일 열기

    프로그램을 실행한 뒤 다음 순서로 진행합니다.

    1. 상단의 Open Database를 클릭합니다.
    2. 열고 싶은 .db, .sqlite, .sqlite3 파일을 선택합니다.
    3. 파일이 열리면 데이터베이스 구조가 화면에 표시됩니다.

    화면에는 보통 다음 탭이 표시됩니다.

    기능
    Database Structure테이블, 컬럼, 인덱스 구조 확인
    Browse Data테이블 데이터 조회와 수정
    Edit PragmasSQLite 설정 확인
    Execute SQLSQL 쿼리 실행

    테이블 구조 확인하기

    파일을 열었다면 먼저 Database Structure 탭을 확인합니다. 이곳에서 데이터베이스 안에 어떤 테이블이 있는지 볼 수 있습니다.

    예를 들어 다음과 같은 테이블이 있을 수 있습니다.

    users
    orders
    products
    settings
    logs

    각 테이블을 선택하면 컬럼 이름, 데이터 타입, 기본키 여부를 확인할 수 있습니다.

    컬럼명타입의미
    idINTEGER고유 번호
    nameTEXT이름
    emailTEXT이메일
    created_atTEXT생성일

    처음 보는 SQLite 파일이라면 데이터를 수정하기 전에 테이블 구조부터 확인하는 것이 안전합니다.

    데이터 조회와 수정하기

    데이터를 직접 보고 싶다면 Browse Data 탭을 사용합니다.

    1. Browse Data 탭을 클릭합니다.
    2. 상단의 테이블 선택 목록에서 원하는 테이블을 고릅니다.
    3. 데이터가 표 형태로 표시됩니다.

    셀을 클릭하면 값을 수정할 수 있습니다. 수정한 뒤에는 반드시 상단의 Write Changes 버튼을 눌러야 실제 파일에 저장됩니다. 반대로 저장하지 않고 취소하려면 Revert Changes를 사용합니다.

    중요한 파일이라면 원본을 바로 수정하지 말고 복사본을 만든 뒤 테스트하는 것이 좋습니다.

    SQL 쿼리 실행하기

    DB Browser for SQLite의 Execute SQL 탭에서는 SQL 쿼리를 직접 실행할 수 있습니다.

    전체 데이터를 확인하려면 다음과 같이 입력합니다.

    SELECT * FROM users;

    최근 10개 데이터만 보고 싶다면 다음과 같이 실행합니다.

    SELECT *
    FROM users
    ORDER BY id DESC
    LIMIT 10;

    특정 조건에 맞는 데이터만 찾을 수도 있습니다.

    SELECT *
    FROM users
    WHERE email LIKE '%gmail.com';

    삭제나 수정 쿼리를 실행하기 전에는 먼저 SELECT로 대상 데이터를 확인해야 합니다.

    SELECT *
    FROM users
    WHERE id = 10;

    확인 후 필요한 경우에만 UPDATE를 실행합니다.

    UPDATE users
    SET name = '김철수'
    WHERE id = 10;

    조건 없는 UPDATE나 DELETE는 전체 데이터에 영향을 줄 수 있으므로 특히 주의해야 합니다.

    자주 쓰는 SQLite 명령어

    SQLite 파일을 확인할 때 자주 사용하는 쿼리는 다음과 같습니다.

    전체 테이블 목록 확인

    SELECT name
    FROM sqlite_master
    WHERE type = 'table';

    특정 테이블의 컬럼 확인

    PRAGMA table_info(users);

    데이터 개수 확인

    SELECT COUNT(*)
    FROM users;

    중복 없는 값 확인

    SELECT DISTINCT category
    FROM products;

    특정 문자열 검색

    SELECT *
    FROM users
    WHERE name LIKE '%홍길동%';

    방법 2. SQLite 명령줄 도구 사용하기

    개발자라면 SQLite 공식 명령줄 도구인 sqlite3.exe를 사용할 수 있습니다.

    SQLite 공식 다운로드 페이지에서 Windows용 도구를 받은 뒤 압축을 풀면 sqlite3.exe 파일을 사용할 수 있습니다.

    PowerShell 또는 명령 프롬프트에서 다음과 같이 실행합니다.

    sqlite3 database.db

    SQLite 프롬프트가 열리면 다음 명령을 사용할 수 있습니다.

    .tables

    테이블 구조를 보고 싶다면 다음 명령을 실행합니다.

    .schema users

    데이터 일부를 조회하려면 다음과 같이 입력합니다.

    SELECT * FROM users LIMIT 10;

    작업을 마치려면 다음 명령으로 종료합니다.

    .quit

    명령줄 도구는 반복 작업, 백업 점검, 간단한 자동화에 유리합니다. 다만 처음 사용하는 사용자에게는 GUI 도구가 더 직관적입니다.

    방법 3. VS Code에서 SQLite 파일 열기

    이미 Visual Studio Code를 사용하고 있다면 SQLite 확장 프로그램을 설치해 파일을 열 수 있습니다.

    사용 순서는 다음과 같습니다.

    1. VS Code를 실행합니다.
    2. Extensions 메뉴를 엽니다.
    3. SQLite 또는 SQLite Viewer를 검색합니다.
    4. 확장 프로그램을 설치합니다.
    5. .db 또는 .sqlite 파일을 열어 테이블을 확인합니다.

    개발 중인 프로젝트 안에서 데이터베이스 내용을 빠르게 확인할 때 유용합니다. SQL 파일, 코드, 데이터베이스를 한 화면에서 함께 볼 수 있다는 점도 장점입니다.

    VS Code 자체가 낯설다면 먼저 기본 설치와 터미널 사용법을 익히는 것이 좋습니다. 관련해서는 Thinknote의 바이브 코딩 입문자가 막히는 이유, 코딩보다 먼저 알아야 할 IT 지도도 함께 참고할 수 있습니다.

    CSV로 내보내고 가져오기

    DB Browser for SQLite에서는 테이블 데이터를 CSV로 내보낼 수 있습니다.

    1. Browse Data 탭에서 테이블을 선택합니다.
    2. 상단 메뉴에서 File을 클릭합니다.
    3. Export를 선택합니다.
    4. Table(s) as CSV file을 선택합니다.
    5. 저장 위치를 지정합니다.

    CSV로 내보내면 Excel이나 Google Sheets에서 데이터를 확인할 수 있습니다.

    반대로 CSV 파일을 SQLite 테이블로 가져올 수도 있습니다.

    1. File 메뉴를 엽니다.
    2. Import를 선택합니다.
    3. Table from CSV file을 선택합니다.
    4. CSV 파일을 선택합니다.
    5. 구분자와 인코딩을 확인합니다.
    6. 가져오기를 실행합니다.

    한글이 깨진다면 인코딩을 UTF-8 또는 CP949 기준으로 다시 확인해야 합니다.

    SQLite 파일이 열리지 않을 때 확인할 점

    SQLite 파일이 열리지 않는다면 다음 항목을 확인합니다.

    확장자만 보고 판단하지 않기

    .db 확장자를 가진 파일이 모두 SQLite 파일은 아닙니다. 일부 프로그램은 자체 데이터 형식에도 .db 확장자를 사용합니다. DB Browser for SQLite에서 열리지 않는다면 SQLite 형식이 아닐 수 있습니다.

    사용 중인 프로그램 종료하기

    어떤 프로그램이 해당 파일을 사용 중이면 파일이 잠겨 수정되지 않을 수 있습니다. 이때는 해당 프로그램을 종료하거나 파일 복사본을 만들어 복사본을 열어봅니다.

    무결성 확인하기

    파일 손상이 의심된다면 SQLite CLI에서 다음 명령을 실행할 수 있습니다.

    PRAGMA integrity_check;

    결과가 ok로 나오면 기본적인 무결성 검사는 통과한 상태입니다.

    수정 전에는 반드시 백업하기

    SQLite는 파일 하나에 데이터베이스 전체가 저장됩니다. 그래서 수정 전 백업이 매우 중요합니다.

    예를 들어 다음처럼 원본을 복사해 둡니다.

    database.db
    database_backup.db

    특히 다음 상황에서는 백업이 필수입니다.

    • 운영 중인 프로그램의 데이터베이스를 수정할 때
    • 고객 데이터나 업무 데이터가 들어 있을 때
    • DELETE, UPDATE, DROP TABLE 명령을 실행할 때
    • 테이블 구조를 변경할 때
    • CSV 가져오기로 대량 데이터를 넣을 때

    SQLite 파일을 직접 편집하는 작업은 간단해 보이지만, 실수하면 복구가 어렵습니다. 수정은 항상 복사본에서 먼저 테스트하는 습관이 좋습니다.

    어떤 도구를 선택하면 좋을까?

    목적에 따라 추천 도구는 조금씩 다릅니다.

    목적추천 도구
    파일 내용을 빠르게 확인DB Browser for SQLite
    데이터를 직접 수정DB Browser for SQLite
    개발 중 DB 확인VS Code SQLite 확장
    명령어 기반 점검SQLite CLI
    반복 작업 자동화SQLite CLI 또는 Python
    엑셀 연동CSV 내보내기와 가져오기

    처음이라면 DB Browser for SQLite로 시작하고, 익숙해지면 SQLite CLI와 VS Code 확장을 함께 사용하는 흐름이 가장 무난합니다.

    마무리

    Windows 11에서 SQLite 파일을 여는 방법은 어렵지 않습니다. 가장 쉬운 방법은 DB Browser for SQLite를 설치해 .db, .sqlite, .sqlite3 파일을 여는 것입니다.

    파일을 열면 테이블 구조를 확인하고, 데이터를 조회하고, 필요한 경우 SQL 쿼리로 검색하거나 수정할 수 있습니다. 다만 SQLite는 하나의 파일에 모든 데이터가 들어 있으므로 수정 전에는 반드시 백업해야 합니다.

    정리하면 다음과 같습니다.

    • 초보자는 DB Browser for SQLite가 가장 쉽습니다.
    • 개발자는 VS Code 확장이나 SQLite CLI를 함께 쓰면 편합니다.
    • 데이터를 수정하기 전에는 원본 파일을 백업해야 합니다.
    • 삭제와 수정 쿼리는 먼저 SELECT로 대상을 확인한 뒤 실행해야 합니다.
    • CSV 내보내기와 가져오기를 활용하면 Excel과 연동하기 쉽습니다.

    SQLite는 가볍지만 매우 실용적인 데이터베이스입니다. Windows 11에서도 적절한 도구를 사용하면 SQLite 파일을 안전하게 열고 관리할 수 있습니다.

    FAQ

    SQLite 파일을 열려면 SQLite 서버를 설치해야 하나요?

    아니요. SQLite는 서버 방식이 아닙니다. SQLite 파일을 열 수 있는 프로그램이나 명령줄 도구만 있으면 됩니다.

    .db 파일은 모두 SQLite 파일인가요?

    아닙니다. .db 확장자를 사용하더라도 SQLite가 아닌 자체 형식 파일일 수 있습니다. DB Browser for SQLite에서 열리지 않는다면 파일 형식을 다시 확인해야 합니다.

    SQLite 파일을 수정해도 바로 저장되나요?

    DB Browser for SQLite에서는 값을 수정한 뒤 Write Changes를 눌러야 실제 파일에 저장됩니다. 저장 전에는 Revert Changes로 되돌릴 수 있습니다.

    SQLite 파일을 Excel에서 바로 열 수 있나요?

    SQLite 파일을 Excel에서 직접 여는 방식은 일반적이지 않습니다. DB Browser for SQLite에서 CSV로 내보낸 뒤 Excel에서 여는 방법이 가장 쉽습니다.

    Windows 11에서 가장 추천하는 SQLite 도구는 무엇인가요?

    처음 사용하는 사용자라면 DB Browser for SQLite를 추천합니다. 개발자라면 SQLite CLI와 VS Code 확장 프로그램을 함께 사용하면 좋습니다.

    참고자료