{"id":21340259,"url":"https://github.com/mnestorov/sqlite-commands","last_synced_at":"2025-03-16T02:41:56.852Z","repository":{"id":167162292,"uuid":"642735222","full_name":"mnestorov/sqlite-commands","owner":"mnestorov","description":"A brief overview of SQLite, a cheat sheet for common SQLite commands, as well as best practices for integrating SQLite with Laravel projects.","archived":false,"fork":false,"pushed_at":"2023-11-30T10:02:26.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T15:28:33.083Z","etag":null,"topics":["sqlite","sqlite-cheat-sheet","sqlite-commands","sqlite-database","sqlite3"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnestorov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-19T08:23:29.000Z","updated_at":"2024-05-15T14:34:08.000Z","dependencies_parsed_at":"2023-06-02T17:30:23.711Z","dependency_job_id":null,"html_url":"https://github.com/mnestorov/sqlite-commands","commit_stats":null,"previous_names":["mnestorov/sqlite-commands"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fsqlite-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fsqlite-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fsqlite-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fsqlite-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnestorov","download_url":"https://codeload.github.com/mnestorov/sqlite-commands/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817436,"owners_count":20352557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sqlite","sqlite-cheat-sheet","sqlite-commands","sqlite-database","sqlite3"],"created_at":"2024-11-22T00:49:52.576Z","updated_at":"2025-03-16T02:41:56.832Z","avatar_url":"https://github.com/mnestorov.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLite Commands\n\n![Licence](https://img.shields.io/badge/Unlicense-red)\n\n## Overview\n\nA brief overview of SQLite, a cheat sheet for common SQLite commands, as well as best practices for integrating SQLite with Laravel projects.\n\n## Table Operations\n\n- [Create a new table](#create-a-new-table)\n- [Delete a table](#delete-a-table)\n- [Get details of a table structure](#get-details-of-a-table-structure)\n- [Print the SQL CREATE statement for an existing table](#print-the-SQL-CREATE-statement-for-an-existing-table)\n\n## Data Operations\n\n- [Insert new data into a table](#insert-new-data-into-a-table)\n- [Select all data from a table](#select-all-data-from-a-table)\n- [Select specific columns from a table](#select-specific-columns-from-a-table)\n- [Update data in a table](#update-data-in-a-table)\n- [Delete data from a table](#delete-data-from-a-table)\n\n## Transaction Control Operations\n\n- [Start a new transaction](#start-a-new-transaction)\n- [Save the changes made in the transaction](#save-the-changes-made-in-the-transaction)\n- [Roll back the changes if any error occurs inside the transaction](#roll-back-the-changes-if-any-error-occurs-inside-the-transaction)\n\n## Table Operations\n\n### Create a new table\n\n```\nCREATE TABLE table_name (column1 datatype, column2 datatype, …);\n```\n\n### Delete a table\n\n```\nDROP TABLE table_name;\n```\n\n### Get details of a table structure\n\n```\nPRAGMA table_info(table_name);\n```\n\n### Print the SQL CREATE statement for an existing table\n\n```\n.schema table_name\n```\n\n## Data Operations\n\n### Insert new data into a table\n\n```\nINSERT INTO table_name (column1, column2, …) VALUES (value1, value2, …);\n```\n\n### Select all data from a table\n\n```\nSELECT * FROM table_name;\n```\n\n### Select specific columns from a table\n\n```\nSELECT column1, column2, … FROM table_name;\n```\n\n### Update data in a table\n\n```\nUPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition;\n```\n\n### Delete data from a table\n\n```\nDELETE FROM table_name WHERE condition;\n```\n\n## Transaction Control Operations\n\n### Start a new transaction\n\n```\nBEGIN TRANSACTION;\n```\n\n### Save the changes made in the transaction\n\n```\nCOMMIT;\n```\n\n### Roll back the changes if any error occurs inside the transaction\n\n```\nROLLBACK;\n```\n\n## SQLite Documentation Links\n\n**For further reference, you can visit the official SQLite documentation:**\n\n- [SQLite Homepage](https://www.sqlite.org/index.html)\n- [SQL Syntax](https://www.sqlite.org/lang.html)\n- [SQLite Commands](https://www.sqlite.org/cli.html)\n- [SQLite Pragmas](https://www.sqlite.org/pragma.html)\n- [SQLite Frequently Asked Questions](https://www.sqlite.org/faq.html)\n\n## Best Practices for SQLite with Laravel\n\nWhen integrating SQLite with Laravel, you should store your SQLite database file within the database directory of your Laravel project. This is because the database directory is designed to hold all database related files and Laravel is configured to easily access this location.\n\n```\n/database\n    /sqlite\n        - database.sqlite\n```\n\n**Be sure to update your `.env` file with the appropriate database configuration:**\n\n```\nDB_CONNECTION=sqlite\nDB_DATABASE=/absolute/path/to/your/database.sqlite\n```\n\nNote: When using version control systems like git, remember to add the SQLite database file to your `.gitignore` file to prevent the database from being tracked. This is important because you typically don't want to expose your database data, especially if it contains sensitive information, to the public or have it be part of your source code.\n\n**Here's what you could add to your `.gitignore`:**\n\n```\n/database/sqlite/*.sqlite\n```\n\n---\n\n## License\n\nThis repository is unlicense[d], so feel free to fork.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fsqlite-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnestorov%2Fsqlite-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fsqlite-commands/lists"}